Skip to content

Commit

Permalink
feat(LanguageData): ConractService & Default (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
a0m0rajab authored Sep 9, 2024
2 parents 1c4e63a + 1d9ef7f commit 99390fc
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 0 deletions.
100 changes: 100 additions & 0 deletions apps/web/src/language-data/ContractService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ const data: LanguageDataType = {
export interface ContractServiceResource {
Refund: string;
RefundTables: string;
"Contracts.Create.Title": string;
"Contracts.Create.Description": string;
"Contracts.Create.Step.Next": string;
"Contracts.Create.Step.Previous": string;
"Contracts.Create.Step.Submit": string;
"Contracts.Create.Step.Merchant": string;
"Contracts.Create.Step.SelectMerchant": string;
"Contracts.Create.Step.SelectMerchantAddress": string;
"Contracts.Create.Step.ContractSettings": string;
"Contracts.Create.Step.Documents": string;
"Contracts.Create.Step.Documents.Dropzone.Title": string;
"Contracts.Create.Step.Documents.Dropzone.Description": string;
"Contracts.Create.Step.Documents.Files.Title": string;
"Contracts.Create.Step.Documents.Files.Description": string;
"Contracts.Create.Step.Documents.NoFile.Title": string;
"Contracts.Create.Step.Documents.NoFile.Description": string;
"RefundTables.Title": string;
"RefundTables.Description": string;
"RefundTables.Create.Title": string;
Expand Down Expand Up @@ -56,6 +72,10 @@ export interface ContractServiceResource {
"RefundFees.Page.Edit.Title": string;
"RefundFees.Page.Edit.Description": string;
"RefundFees.Page.Edit.Delete": string;
"RefundFees.Page.Edit.Delete.Title": string;
"RefundFees.Page.Edit.Delete.Description": string;
"RefundFees.Page.Edit.Delete.Cancel": string;
"RefundFees.Page.Edit.Delete.Confirm": string;
"RefundFees.Page.Edit.Save": string;
"RefundFees.Page.Edit.Fee.Edit": string;
"RefundFees.Page.Edit.Fee.Edit.Title": string;
Expand Down Expand Up @@ -116,6 +136,70 @@ function getLanguageData(
resource?.RefundTables ||
data[lang]?.RefundTables ||
data.en.RefundTables,
"Contracts.Create.Title":
resource?.["Contracts.Create.Title"] ||
data[lang]?.["Contracts.Create.Title"] ||
data.en["Contracts.Create.Title"],
"Contracts.Create.Description":
resource?.["Contracts.Create.Description"] ||
data[lang]?.["Contracts.Create.Description"] ||
data.en["Contracts.Create.Description"],
"Contracts.Create.Step.Next":
resource?.["Contracts.Create.Step.Next"] ||
data[lang]?.["Contracts.Create.Step.Next"] ||
data.en["Contracts.Create.Step.Next"],
"Contracts.Create.Step.Previous":
resource?.["Contracts.Create.Step.Previous"] ||
data[lang]?.["Contracts.Create.Step.Previous"] ||
data.en["Contracts.Create.Step.Previous"],
"Contracts.Create.Step.Submit":
resource?.["Contracts.Create.Step.Submit"] ||
data[lang]?.["Contracts.Create.Step.Submit"] ||
data.en["Contracts.Create.Step.Submit"],
"Contracts.Create.Step.Merchant":
resource?.["Contracts.Create.Step.Merchant"] ||
data[lang]?.["Contracts.Create.Step.Merchant"] ||
data.en["Contracts.Create.Step.Merchant"],
"Contracts.Create.Step.SelectMerchant":
resource?.["Contracts.Create.Step.SelectMerchant"] ||
data[lang]?.["Contracts.Create.Step.SelectMerchant"] ||
data.en["Contracts.Create.Step.SelectMerchant"],
"Contracts.Create.Step.SelectMerchantAddress":
resource?.["Contracts.Create.Step.SelectMerchantAddress"] ||
data[lang]?.["Contracts.Create.Step.SelectMerchantAddress"] ||
data.en["Contracts.Create.Step.SelectMerchantAddress"],
"Contracts.Create.Step.ContractSettings":
resource?.["Contracts.Create.Step.ContractSettings"] ||
data[lang]?.["Contracts.Create.Step.ContractSettings"] ||
data.en["Contracts.Create.Step.ContractSettings"],
"Contracts.Create.Step.Documents":
resource?.["Contracts.Create.Step.Documents"] ||
data[lang]?.["Contracts.Create.Step.Documents"] ||
data.en["Contracts.Create.Step.Documents"],
"Contracts.Create.Step.Documents.Dropzone.Title":
resource?.["Contracts.Create.Step.Documents.Dropzone.Title"] ||
data[lang]?.["Contracts.Create.Step.Documents.Dropzone.Title"] ||
data.en["Contracts.Create.Step.Documents.Dropzone.Title"],
"Contracts.Create.Step.Documents.Dropzone.Description":
resource?.["Contracts.Create.Step.Documents.Dropzone.Description"] ||
data[lang]?.["Contracts.Create.Step.Documents.Dropzone.Description"] ||
data.en["Contracts.Create.Step.Documents.Dropzone.Description"],
"Contracts.Create.Step.Documents.Files.Title":
resource?.["Contracts.Create.Step.Documents.Files.Title"] ||
data[lang]?.["Contracts.Create.Step.Documents.Files.Title"] ||
data.en["Contracts.Create.Step.Documents.Files.Title"],
"Contracts.Create.Step.Documents.Files.Description":
resource?.["Contracts.Create.Step.Documents.Files.Description"] ||
data[lang]?.["Contracts.Create.Step.Documents.Files.Description"] ||
data.en["Contracts.Create.Step.Documents.Files.Description"],
"Contracts.Create.Step.Documents.NoFile.Title":
resource?.["Contracts.Create.Step.Documents.NoFile.Title"] ||
data[lang]?.["Contracts.Create.Step.Documents.NoFile.Title"] ||
data.en["Contracts.Create.Step.Documents.NoFile.Title"],
"Contracts.Create.Step.Documents.NoFile.Description":
resource?.["Contracts.Create.Step.Documents.NoFile.Description"] ||
data[lang]?.["Contracts.Create.Step.Documents.NoFile.Description"] ||
data.en["Contracts.Create.Step.Documents.NoFile.Description"],
"RefundTables.Title":
resource?.["RefundTables.Title"] ||
data[lang]?.["RefundTables.Title"] ||
Expand Down Expand Up @@ -306,6 +390,22 @@ function getLanguageData(
resource?.["RefundFees.Page.Edit.Delete"] ||
data[lang]?.["RefundFees.Page.Edit.Delete"] ||
data.en["RefundFees.Page.Edit.Delete"],
"RefundFees.Page.Edit.Delete.Title":
resource?.["RefundFees.Page.Edit.Delete.Title"] ||
data[lang]?.["RefundFees.Page.Edit.Delete.Title"] ||
data.en["RefundFees.Page.Edit.Delete.Title"],
"RefundFees.Page.Edit.Delete.Description":
resource?.["RefundFees.Page.Edit.Delete.Description"] ||
data[lang]?.["RefundFees.Page.Edit.Delete.Description"] ||
data.en["RefundFees.Page.Edit.Delete.Description"],
"RefundFees.Page.Edit.Delete.Cancel":
resource?.["RefundFees.Page.Edit.Delete.Cancel"] ||
data[lang]?.["RefundFees.Page.Edit.Delete.Cancel"] ||
data.en["RefundFees.Page.Edit.Delete.Cancel"],
"RefundFees.Page.Edit.Delete.Confirm":
resource?.["RefundFees.Page.Edit.Delete.Confirm"] ||
data[lang]?.["RefundFees.Page.Edit.Delete.Confirm"] ||
data.en["RefundFees.Page.Edit.Delete.Confirm"],
"RefundFees.Page.Edit.Save":
resource?.["RefundFees.Page.Edit.Save"] ||
data[lang]?.["RefundFees.Page.Edit.Save"] ||
Expand Down
21 changes: 21 additions & 0 deletions apps/web/src/language-data/ContractService/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
"Refund": "Refund",
"RefundTables": "Refund tables",

"Contracts.Create.Title": "Create contract",
"Contracts.Create.Description": "Create a new contract",
"Contracts.Create.Step.Next": "Next",
"Contracts.Create.Step.Previous": "Previous",
"Contracts.Create.Step.Submit": "Submit",
"Contracts.Create.Step.Merchant": "Select Merchant",
"Contracts.Create.Step.SelectMerchant": "Select merchant",
"Contracts.Create.Step.SelectMerchantAddress": "Select merchant address",
"Contracts.Create.Step.ContractSettings": "Contract Settings",
"Contracts.Create.Step.Documents": "Documents",
"Contracts.Create.Step.Documents.Dropzone.Title": "Drag 'n' drop files here, or click to select files",
"Contracts.Create.Step.Documents.Dropzone.Description": "You can upload 4 files (up to 4 MB each)",
"Contracts.Create.Step.Documents.Files.Title": "Uploaded files",
"Contracts.Create.Step.Documents.Files.Description": "View the uploaded files here",
"Contracts.Create.Step.Documents.NoFile.Title": "No files uploaded",
"Contracts.Create.Step.Documents.NoFile.Description": "Upload some files",

"RefundTables.Title": "Refund tables",
"RefundTables.Description": "Manage refund tables",

Expand Down Expand Up @@ -54,6 +71,10 @@
"RefundFees.Page.Edit.Title": "Edit refund fee {0}",
"RefundFees.Page.Edit.Description": "Edit refund fee",
"RefundFees.Page.Edit.Delete": "Delete",
"RefundFees.Page.Edit.Delete.Title": "Delete refund fee",
"RefundFees.Page.Edit.Delete.Description": "Are you sure you want to delete this refund fee?",
"RefundFees.Page.Edit.Delete.Cancel": "Cancel",
"RefundFees.Page.Edit.Delete.Confirm": "Confirm",
"RefundFees.Page.Edit.Save": "Save",

"RefundFees.Page.Edit.Fee.Edit": "Edit",
Expand Down
15 changes: 15 additions & 0 deletions apps/web/src/language-data/ContractService/resources/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
"Refund": "İade",
"RefundTables": "İade Tabloları",

"Contracts.Create.Title": "Sözleşmeyi Oluştur",
"Contracts.Create.Description": "Yeni bir sözleşme oluşturun",
"Contracts.Create.Step.Next": "Sonraki",
"Contracts.Create.Step.Previous": "Önceki",
"Contracts.Create.Step.Submit": "Kaydet",
"Contracts.Create.Step.Merchant": "Mağaza Seçin",
"Contracts.Create.Step.SelectMerchant": "Mağaza Seçin",
"Contracts.Create.Step.SelectMerchantAddress": "Mağaza Adresini Seçin",
"Contracts.Create.Step.ContractSettings": "Sözleşme Ayarları",
"Contracts.Create.Step.Documents": "Dokümanlar",

"RefundTables.Title": "İade Tabloları",
"RefundTables.Description": "İade tablolarını yönetin",

Expand Down Expand Up @@ -54,6 +65,10 @@
"RefundFees.Page.Edit.Title": "İade ücretini düzenle {0}",
"RefundFees.Page.Edit.Description": "İade ücretini düzenle",
"RefundFees.Page.Edit.Delete": "Sil",
"RefundFees.Page.Edit.Delete.Title": "İade ücterini sil",
"RefundFees.Page.Edit.Delete.Description": "İade ücretini silmek istediğinizden emin misiniz?",
"RefundFees.Page.Edit.Delete.Cancel": "İptal",
"RefundFees.Page.Edit.Delete.Confirm": "Devam et",
"RefundFees.Page.Edit.Save": "Kaydet",

"RefundFees.Page.Edit.Fee.Edit": "Düzenle",
Expand Down
92 changes: 92 additions & 0 deletions apps/web/src/language-data/Default/index.ts
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;
}
14 changes: 14 additions & 0 deletions apps/web/src/language-data/Default/resources/en.json
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"
}
14 changes: 14 additions & 0 deletions apps/web/src/language-data/Default/resources/tr.json
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"
}

0 comments on commit 99390fc

Please sign in to comment.