Skip to content
Merged

i18n #437

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9075f93
feat(crowdin): config
hiheyhello123 Mar 13, 2025
2576900
minor
hiheyhello123 Mar 13, 2025
5350211
Update Crowdin configuration file
MrgSub Mar 13, 2025
fa7b69c
minor
hiheyhello123 Mar 13, 2025
274162a
fix
hiheyhello123 Mar 13, 2025
d9e2f8e
Update Crowdin configuration file
MrgSub Mar 13, 2025
f7752ba
New translations default.json (French)
MrgSub Mar 13, 2025
e5228ab
New translations default.json (Spanish)
MrgSub Mar 13, 2025
9221f74
New translations default.json (Arabic)
MrgSub Mar 13, 2025
edf9f7e
New translations default.json (German)
MrgSub Mar 13, 2025
5fe280e
New translations default.json (Portuguese)
MrgSub Mar 13, 2025
7a2d0af
New translations default.json (Turkish)
MrgSub Mar 13, 2025
937456d
New translations default.json (French)
MrgSub Mar 13, 2025
e3bd962
New translations default.json (Spanish)
MrgSub Mar 13, 2025
44e92bd
New translations default.json (Turkish)
MrgSub Mar 13, 2025
f60a85e
New translations default.json (French)
longgoneaccount Mar 13, 2025
1b6b063
New translations default.json (Spanish)
longgoneaccount Mar 13, 2025
fa5d21f
New translations default.json (Arabic)
longgoneaccount Mar 13, 2025
3d77094
New translations default.json (German)
longgoneaccount Mar 13, 2025
64f5d77
New translations default.json (Portuguese)
longgoneaccount Mar 13, 2025
5f4a477
New translations default.json (Turkish)
longgoneaccount Mar 13, 2025
a9c7936
fix i18n
hiheyhello123 Mar 13, 2025
564cfdc
Merge branch 'i18n' of https://github.com/Mail-0/Zero into crowdin
hiheyhello123 Mar 13, 2025
de86cb4
minor
hiheyhello123 Mar 13, 2025
4bc54a0
Update Crowdin configuration file
longgoneaccount Mar 13, 2025
afd7634
New translations en.json (French)
longgoneaccount Mar 14, 2025
63a98e2
New translations en.json (Spanish)
longgoneaccount Mar 14, 2025
54171ff
New translations en.json (Arabic)
longgoneaccount Mar 14, 2025
7040528
New translations en.json (German)
longgoneaccount Mar 14, 2025
37485ea
New translations en.json (Portuguese)
longgoneaccount Mar 14, 2025
6b8a235
New translations en.json (Turkish)
longgoneaccount Mar 14, 2025
7e4c518
Merge pull request #436 from Mail-0/i18n
hiheyhello123 Mar 14, 2025
ebb110c
fix
hiheyhello123 Mar 14, 2025
5350e04
Merge branch 'crowdin' of https://github.com/Mail-0/Zero into crowdin
hiheyhello123 Mar 14, 2025
202e92f
fix
hiheyhello123 Mar 14, 2025
8c1acd8
minor
hiheyhello123 Mar 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/mail/app/(routes)/settings/general/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function GeneralPage() {
const router = useRouter();
const [isSaving, setIsSaving] = useState(false);
const locale = useLocale();
const t = useTranslations();

const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
Expand All @@ -59,6 +60,11 @@ export default function GeneralPage() {

changeLocale(values.language);

if (values.language !== locale) {
const localeName = new Intl.DisplayNames([values.language], { type: 'language' }).of(values.language);
toast.success(t("pages.settings.general.languageChangedTo", { language: localeName }));
}

// Simulate API call
setTimeout(() => {
console.log(values);
Expand All @@ -83,8 +89,6 @@ export default function GeneralPage() {
);
};

const t = useTranslations();

return (
<div className="grid gap-6">
<SettingsCard
Expand Down
12 changes: 12 additions & 0 deletions apps/mail/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export const availableLocales = [
code: "en",
name: "English",
},
{
code: "ar",
name: "Arabic",
},
{
code: "fr",
name: "French",
Expand All @@ -17,6 +21,14 @@ export const availableLocales = [
code: "es-ES",
name: "Spanish",
},
{
code: "de",
name: "German",
},
{
code: "pt-PT",
name: "Portuguese",
},
];

export const locales = availableLocales.map((locale) => locale.code);
Expand Down
4 changes: 3 additions & 1 deletion apps/mail/i18n/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import deepmerge from "deepmerge";
export default getRequestConfig(async () => {
const locale = await getLocale();

const userMessages = (await import(`../locales/${locale}.json`)).default;
const baseLanguage = locale?.split("-")[0] || "en";

const userMessages = (await import(`../locales/${baseLanguage}.json`)).default;
const defaultMessages = (await import(`../locales/en.json`)).default;
const messages = deepmerge(defaultMessages, userMessages);

Expand Down
226 changes: 226 additions & 0 deletions apps/mail/locales/ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
{
"common": {
"actions": {
"logout": "Logout",
"back": "Back",
"create": "Create Email",
"saveChanges": "Save changes",
"saving": "Saving...",
"resetToDefaults": "Reset to Defaults",
"close": "Close",
"signingOut": "Signing out...",
"signedOutSuccess": "Signed out successfully!",
"signOutError": "Error signing out"
},
"themes": {
"dark": "Dark",
"light": "Light",
"system": "System"
},
"commandPalette": {
"title": "Command Palette",
"description": "Quick navigation and actions for Mail-0",
"placeholder": "Type a command or search...",
"noResults": "No results found",
"groups": {
"mail": "Mail",
"settings": "Settings",
"actions": "Actions",
"help": "Help",
"navigation": "Navigation"
},
"commands": {
"goToInbox": "Go to Inbox",
"goToDrafts": "Go to Drafts",
"goToSent": "Go to Sent",
"goToSpam": "Go to Spam",
"goToArchive": "Go to Archive",
"goToBin": "Go to Bin",
"goToSettings": "Go to Settings",
"newEmail": "New Email",
"composeMessage": "Compose message",
"searchEmails": "Search Emails",
"toggleTheme": "Toggle Theme",
"backToMail": "Back to Mail",
"goToDocs": "Go to docs",
"helpWithShortcuts": "Help with shortcuts"
}
},
"searchBar": {
"pickDateRange": "Pick a date or a range",
"search": "Search",
"clearSearch": "Clear search",
"advancedSearch": "Advanced search",
"quickFilters": "Quick filters",
"searchIn": "Search in",
"recipient": "Recipient",
"sender": "Sender",
"subject": "Subject",
"dateRange": "Date range",
"category": "Category",
"folder": "Folder",
"allMail": "All Mail",
"unread": "Unread",
"hasAttachment": "Has Attachment",
"starred": "Starred",
"applyFilters": "Apply filters",
"reset": "Reset"
},
"navUser": {
"customerSupport": "Customer Support",
"documentation": "Documentation",
"appTheme": "App Theme",
"accounts": "Accounts",
"signIn": "Sign in"
},
"mailCategories": {
"primary": "Primary",
"important": "Important",
"personal": "Personal",
"updates": "Updates",
"promotions": "Promotions",
"social": "Social"
},
"replyCompose": {
"replyTo": "Reply to",
"thisEmail": "this email",
"dropFiles": "Drop files to attach",
"attachments": "Attachments",
"attachmentCount": "{count, plural, =0 {attachments} one {attachment} other {attachments}}",
"fileCount": "{count, plural, =0 {files} one {file} other {files}}",
"saveDraft": "Save draft",
"send": "Send"
},
"mailDisplay": {
"details": "Details",
"from": "From",
"to": "To",
"cc": "Cc",
"date": "Date",
"mailedBy": "Mailed-By",
"signedBy": "Signed-By",
"security": "Security",
"standardEncryption": "Standard encryption (TLS)",
"loadingMailContent": "Loading mail content..."
},
"threadDisplay": {
"exitFullscreen": "Exit fullscreen",
"enterFullscreen": "Enter fullscreen",
"archive": "Archive",
"reply": "Reply",
"moreOptions": "More options",
"moveToSpam": "Move to spam",
"replyAll": "Reply all",
"forward": "Forward",
"markAsUnread": "Mark as unread",
"addLabel": "Add label",
"muteThread": "Mute thread"
}
},
"navigation": {
"sidebar": {
"inbox": "Inbox",
"drafts": "Drafts",
"sent": "Sent",
"spam": "Spam",
"archive": "Archive",
"bin": "Bin",
"settings": "Settings"
},
"settings": {
"general": "General",
"connections": "Connections",
"security": "Security",
"appearance": "Appearance",
"shortcuts": "Shortcuts"
}
},
"pages": {
"error": {
"notFound": {
"title": "Page Not Found",
"description": "Oops! The page you're looking for doesn't exist or has been moved.",
"goBack": "Go Back"
},
"settingsNotFound": "404 - Settings page not found"
},
"settings": {
"general": {
"title": "General",
"description": "Manage settings for your language and email display preferences.",
"language": "Language",
"timezone": "Timezone",
"dynamicContent": "Dynamic Content",
"dynamicContentDescription": "Allow emails to display dynamic content.",
"externalImages": "Display External Images",
"externalImagesDescription": "Allow emails to display images from external sources.",
"languageChangedTo": "Language changed to {language}"
},
"connections": {
"title": "Email Connections",
"description": "Connect your email accounts to Zero.",
"disconnectTitle": "Disconnect Email Account",
"disconnectDescription": "Are you sure you want to disconnect this email?",
"cancel": "Cancel",
"remove": "Remove",
"disconnectSuccess": "Account disconnected successfully",
"disconnectError": "Failed to disconnect account",
"addEmail": "Add Connection",
"connectEmail": "Connect Email",
"connectEmailDescription": "Select an email provider to connect",
"moreComingSoon": "More coming soon"
},
"security": {
"title": "Security",
"description": "Manage your security preferences and account protection.",
"twoFactorAuth": "Two-Factor Authentication",
"twoFactorAuthDescription": "Add an extra layer of security to your account",
"loginNotifications": "Login Notifications",
"loginNotificationsDescription": "Get notified about new login attempts",
"deleteAccount": "Delete Account"
},
"appearance": {
"title": "Appearance",
"description": "Customize colors, fonts and view options.",
"theme": "Theme",
"inboxType": "Inbox Type"
},
"shortcuts": {
"title": "Keyboard Shortcuts",
"description": "View and customize keyboard shortcuts for quick actions.",
"actions": {
"newEmail": "New Email",
"sendEmail": "Send Email",
"reply": "Reply",
"replyAll": "Reply All",
"forward": "Forward",
"drafts": "Drafts",
"inbox": "Inbox",
"sentMail": "Sent Mail",
"delete": "Delete",
"search": "Search",
"markAsUnread": "Mark as Unread",
"muteThread": "Mute Thread",
"printEmail": "Print Email",
"archiveEmail": "Archive Email",
"markAsSpam": "Mark as Spam",
"moveToFolder": "Move to Folder",
"undoLastAction": "Undo Last Action",
"viewEmailDetails": "View Email Details",
"goToDrafts": "Go to Drafts",
"expandEmailView": "Expand Email View",
"helpWithShortcuts": "Help with shortcuts"
}
}
},
"createEmail": {
"body": "Body",
"example": "zero@0.email",
"attachments": "Attachments",
"dropFilesToAttach": "Drop files to attach",
"writeYourMessageHere": "Write your message here...",
"emailSentSuccessfully": "Email sent successfully",
"failedToSendEmail": "Failed to send email. Please try again."
}
}
}
Loading