-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(LanguageData): ConractService & Default (#611)
- Loading branch information
Showing
6 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import type { LanguageDataType, ResourceResult } from "src/utils"; | ||
import { getLocalizationResources } from "src/utils"; | ||
import en from "./resources/en.json"; | ||
import tr from "./resources/tr.json"; | ||
|
||
const data: LanguageDataType = { | ||
tr, | ||
en, | ||
}; | ||
|
||
export interface DefaultResource { | ||
"FileUploader.CannotUploadMoreThanOne": string; | ||
"FileUploader.CannotUploadMoreThan{0}": string; | ||
"FileUploader.RejectedFile {0}": string; | ||
"FileUploader.Files": string; | ||
"FileUploader.File": string; | ||
"FileUploader.Uploading{0}": string; | ||
"FileUploader.{0}Uploaded": string; | ||
"FileUploader.FailedToUpload{0}": string; | ||
"FileUploader.DropTheFilesHere": string; | ||
"FileUploader.DragAndDropFilesHere": string; | ||
"FileUploader.YouCanUpload{0}files{1}each": string; | ||
"FileUploader.RemoveFile": string; | ||
} | ||
function getLanguageData( | ||
resources: ResourceResult, | ||
lang: string, | ||
): DefaultResource { | ||
const resource = resources.Default?.texts; | ||
return { | ||
"FileUploader.CannotUploadMoreThanOne": | ||
resource?.["FileUploader.CannotUploadMoreThanOne"] || | ||
data[lang]?.["FileUploader.CannotUploadMoreThanOne"] || | ||
data.en["FileUploader.CannotUploadMoreThanOne"], | ||
"FileUploader.CannotUploadMoreThan{0}": | ||
resource?.["FileUploader.CannotUploadMoreThan{0}"] || | ||
data[lang]?.["FileUploader.CannotUploadMoreThan{0}"] || | ||
data.en["FileUploader.CannotUploadMoreThan{0}"], | ||
"FileUploader.RejectedFile {0}": | ||
resource?.["FileUploader.RejectedFile {0}"] || | ||
data[lang]?.["FileUploader.RejectedFile {0}"] || | ||
data.en["FileUploader.RejectedFile {0}"], | ||
"FileUploader.Files": | ||
resource?.["FileUploader.Files"] || | ||
data[lang]?.["FileUploader.Files"] || | ||
data.en["FileUploader.Files"], | ||
"FileUploader.File": | ||
resource?.["FileUploader.File"] || | ||
data[lang]?.["FileUploader.File"] || | ||
data.en["FileUploader.File"], | ||
"FileUploader.Uploading{0}": | ||
resource?.["FileUploader.Uploading{0}"] || | ||
data[lang]?.["FileUploader.Uploading{0}"] || | ||
data.en["FileUploader.Uploading{0}"], | ||
"FileUploader.{0}Uploaded": | ||
resource?.["FileUploader.{0}Uploaded"] || | ||
data[lang]?.["FileUploader.{0}Uploaded"] || | ||
data.en["FileUploader.{0}Uploaded"], | ||
"FileUploader.FailedToUpload{0}": | ||
resource?.["FileUploader.FailedToUpload{0}"] || | ||
data[lang]?.["FileUploader.FailedToUpload{0}"] || | ||
data.en["FileUploader.FailedToUpload{0}"], | ||
"FileUploader.DropTheFilesHere": | ||
resource?.["FileUploader.DropTheFilesHere"] || | ||
data[lang]?.["FileUploader.DropTheFilesHere"] || | ||
data.en["FileUploader.DropTheFilesHere"], | ||
"FileUploader.DragAndDropFilesHere": | ||
resource?.["FileUploader.DragAndDropFilesHere"] || | ||
data[lang]?.["FileUploader.DragAndDropFilesHere"] || | ||
data.en["FileUploader.DragAndDropFilesHere"], | ||
"FileUploader.YouCanUpload{0}files{1}each": | ||
resource?.["FileUploader.YouCanUpload{0}files{1}each"] || | ||
data[lang]?.["FileUploader.YouCanUpload{0}files{1}each"] || | ||
data.en["FileUploader.YouCanUpload{0}files{1}each"], | ||
"FileUploader.RemoveFile": | ||
resource?.["FileUploader.RemoveFile"] || | ||
data[lang]?.["FileUploader.RemoveFile"] || | ||
data.en["FileUploader.RemoveFile"], | ||
}; | ||
} | ||
export async function getResourceData(lang: string) { | ||
const resources = await getLocalizationResources(lang); | ||
const languageData = getLanguageData(resources, lang); | ||
return { | ||
languageData, | ||
resources, | ||
}; | ||
} | ||
export function getResourceDataClient(resources: ResourceResult, lang: string) { | ||
const languageData = getLanguageData(resources, lang); | ||
return languageData; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"FileUploader.CannotUploadMoreThanOne": "Cannot upload more than 1 file at a time", | ||
"FileUploader.CannotUploadMoreThan{0}": "Cannot upload more than {0} files", | ||
"FileUploader.RejectedFile {0}": "File {0} was rejected", | ||
"FileUploader.Files": "files", | ||
"FileUploader.File": "file", | ||
"FileUploader.Uploading{0}": "Uploading {0}...", | ||
"FileUploader.{0}Uploaded": "{0} uploaded", | ||
"FileUploader.FailedToUpload{0}": "Failed to upload {0}", | ||
"FileUploader.DropTheFilesHere": "Drop the files here", | ||
"FileUploader.DragAndDropFilesHere": "Drag'n drop files here, or click to select files", | ||
"FileUploader.YouCanUpload{0}files{1}each": "You can upload {0} files (up to {1} each)", | ||
"FileUploader.RemoveFile": "Remove file" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"FileUploader.CannotUploadMoreThanOne": "Birden fazla dosya yükleyemezsiniz", | ||
"FileUploader.CannotUploadMoreThan{0}": "En fazla {0} dosya yükleyebilirsiniz", | ||
"FileUploader.RejectedFile {0}": "Dosya {0} reddedildi", | ||
"FileUploader.Files": "dosyalar", | ||
"FileUploader.File": "dosya", | ||
"FileUploader.Uploading{0}": "{0} yükleniyor...", | ||
"FileUploader.{0}Uploaded": "{0} yüklendi", | ||
"FileUploader.FailedToUpload{0}": "{0} yüklenirken hata oluştu", | ||
"FileUploader.DropTheFilesHere": "Dosyaları buraya bırakın", | ||
"FileUploader.DragAndDropFilesHere": "Dosyaları buraya sürükleyin ya da seçmek için tıklatın", | ||
"FileUploader.YouCanUpload{0}files{1}each": "En fazla {0} dosya yükleyebilirsiniz (her biri en fazla {1})", | ||
"FileUploader.RemoveFile": "Dosyayı kaldır" | ||
} |