intl: fix localization

This commit is contained in:
Ammar Ahmed
2024-11-04 16:13:02 +05:00
parent b21548780a
commit 26d1de0620
4 changed files with 3349 additions and 3318 deletions

View File

@@ -279,9 +279,9 @@ export default function ReminderSheet({
{Object.keys(ReminderModes).map((mode) => ( {Object.keys(ReminderModes).map((mode) => (
<Button <Button
key={mode} key={mode}
title={strings.reminderModes[ title={strings.reminderModes(
mode as keyof typeof strings.reminderModes ReminderModes[mode as keyof typeof ReminderModes] as string
]()} )}
style={{ style={{
marginRight: 12, marginRight: 12,
borderRadius: 100, borderRadius: 100,
@@ -337,9 +337,9 @@ export default function ReminderSheet({
{Object.keys(RecurringModes).map((mode) => ( {Object.keys(RecurringModes).map((mode) => (
<Button <Button
key={mode} key={mode}
title={strings.recurringModes[ title={strings.recurringModes(
mode as keyof typeof strings.recurringModes RecurringModes[mode as keyof typeof RecurringModes]
]()} )}
style={{ style={{
marginRight: 6, marginRight: 6,
borderRadius: 100 borderRadius: 100

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -16,38 +16,37 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { I18n } from "@lingui/core";
import { plural, select, t } from "@lingui/macro"; import { plural, select, t } from "@lingui/macro";
const actions = { const actions = {
deleted: t`deleted`, deleted: () => t`deleted`,
unpinned: t`unpinned`, unpinned: () => t`unpinned`,
pinned: t`pinned`, pinned: () => t`pinned`,
unpublished: t`unpublished`, unpublished: () => t`unpublished`,
published: t`published`, published: () => t`published`,
permanentlyDeleted: t`permanently deleted`, permanentlyDeleted: () => t`permanently deleted`,
restored: t`restored`, restored: () => t`restored`,
edited: t`edited`, edited: () => t`edited`,
created: t`created`, created: () => t`created`,
renamed: t`renamed` renamed: () => t`renamed`
}; };
const doActions = { const doActions = {
delete: t`Delete`, delete: () => t`Delete`,
unpin: t`Unpin`, unpin: () => t`Unpin`,
pin: t`Pin`, pin: () => t`Pin`,
unpublish: t`Unpublish`, unpublish: () => t`Unpublish`,
publish: t`Publish`, publish: () => t`Publish`,
permanentlyDelete: t`Permanently delete`, permanentlyDelete: () => t`Permanently delete`,
restore: t`Restore`, restore: () => t`Restore`,
edit: t`Edit`, edit: () => t`Edit`,
create: t`Created`, create: () => t`Created`,
rename: t`Rename`, rename: () => t`Rename`,
remove: t`Remove` remove: () => t`Remove`
}; };
const inProgressActions = { const inProgressActions = {
deleting: t`Delete` deleting: () => t`Delete`
}; };
type Actions = keyof typeof actions; type Actions = keyof typeof actions;
@@ -571,18 +570,18 @@ $headline$: Use starting line of the note as title.`,
noLinkedNotes: () => t`No linked notes`, noLinkedNotes: () => t`No linked notes`,
reminderModes: (mode: string) => reminderModes: (mode: string) =>
select(mode, { select(mode, {
Repeat: t`Repeat`, repeat: "Repeat",
Once: t`Once`, once: "Once",
Permanent: t`Permanent`, permanent: "Permanent",
other: t`Unknown mode` other: "Unknown mode"
}), }),
recurringModes: (mode: string) => recurringModes: (mode: string) =>
select(mode, { select(mode, {
Daily: t`Daily`, day: "Daily",
Weekly: t`Weekly`, week: "Weekly",
Monthly: t`Monthly`, month: "Monthly",
Yearly: t`Yearly`, year: "Yearly",
other: t`Unknown mode` other: "Unknown mode"
}), }),
weekDayNames: { weekDayNames: {
0: () => t`Sunday`, 0: () => t`Sunday`,
@@ -1911,10 +1910,10 @@ All attachments will be downloaded & cached again on access.
irreverisibleAction: () => t`This action is IRREVERSIBLE.`, irreverisibleAction: () => t`This action is IRREVERSIBLE.`,
doAction: (type: string, count: number, action: DoActions) => doAction: (type: string, count: number, action: DoActions) =>
plural(count, { plural(count, {
one: `${doActions[action]} ${strings.dataTypesCamelCase[ one: `${doActions[action]()} ${strings.dataTypesCamelCase[
type as keyof typeof strings.dataTypes type as keyof typeof strings.dataTypes
]()}?`, ]()}?`,
other: `${doActions[action]} # ${strings.dataTypesPlural[ other: `${doActions[action]()} # ${strings.dataTypesPlural[
type as keyof typeof strings.dataTypesPlural type as keyof typeof strings.dataTypesPlural
]()}?` ]()}?`
}), }),
@@ -1922,17 +1921,17 @@ All attachments will be downloaded & cached again on access.
plural(count, { plural(count, {
one: `${strings.dataTypesCamelCase[ one: `${strings.dataTypesCamelCase[
type as keyof typeof strings.dataTypes type as keyof typeof strings.dataTypes
]()} ${actions[action]}`, ]()} ${actions[action]()}`,
other: `# ${strings.dataTypesPlural[ other: `# ${strings.dataTypesPlural[
type as keyof typeof strings.dataTypesPlural type as keyof typeof strings.dataTypesPlural
]()} ${actions[action]}` ]()} ${actions[action]()}`
}), }),
inProgressAction: (type: string, count: number, action: InProgressActions) => inProgressAction: (type: string, count: number, action: InProgressActions) =>
plural(count, { plural(count, {
one: `${inProgressActions[action]} ${strings.dataTypesCamelCase[ one: `${inProgressActions[action]()} ${strings.dataTypesCamelCase[
type as keyof typeof strings.dataTypes type as keyof typeof strings.dataTypes
]()}`, ]()}`,
other: `${inProgressActions[action]} # ${strings.dataTypesPlural[ other: `${inProgressActions[action]()} # ${strings.dataTypesPlural[
type as keyof typeof strings.dataTypesPlural type as keyof typeof strings.dataTypesPlural
]()}` ]()}`
}), }),