summaryrefslogtreecommitdiff
path: root/lib/locales.ts
diff options
context:
space:
mode:
authorJustZvan <justzvan@justzvan.xyz>2026-02-06 13:22:33 +0100
committerJustZvan <justzvan@justzvan.xyz>2026-02-06 13:22:33 +0100
commit7eb8ccae48b0cc18a9dcaa9c3626a02df8e6d919 (patch)
tree57b7dd06ac9aa7053c671d916f7183e3b4fa9410 /lib/locales.ts
feat: initial commit!
Diffstat (limited to 'lib/locales.ts')
-rw-r--r--lib/locales.ts247
1 files changed, 247 insertions, 0 deletions
diff --git a/lib/locales.ts b/lib/locales.ts
new file mode 100644
index 0000000..d78621f
--- /dev/null
+++ b/lib/locales.ts
@@ -0,0 +1,247 @@
+import { getLocales } from "expo-localization";
+
+const en = {
+ home: "Home",
+ alerts: "Alerts",
+ controls: "Controls",
+ settings: "Settings",
+ allClear: "All clear",
+ attentionNeeded: "Attention needed",
+ captchaError: "Captcha verification failed. Please try again.",
+ today: "Today",
+ review: "Review",
+ nothingNeedsAttention: "Nothing needs attention.",
+ fewItemsNeedReview: "A few items need review.",
+ deviceIsOnline: "Device is online",
+ deviceIsOffline: "Device is offline",
+ protectionActive: "Protection active.",
+ reconnectingAutomatically: "Reconnecting automatically.",
+ recentAlerts: "Recent alerts",
+ last24Hours: "Last 24 hours",
+ thisWeek: "This week",
+ needsAction: "needs action",
+ reviewed: "reviewed",
+ // Onboarding & Auth
+ welcomeTitle: "Welcome to Buddy",
+ welcomeSubtitle: "Keep your family safe online with smart parental controls.",
+ getStarted: "Get Started",
+ signIn: "Sign In",
+ signUp: "Sign Up",
+ email: "Email",
+ password: "Password",
+ confirmPassword: "Confirm Password",
+ emailPlaceholder: "Enter your email",
+ passwordPlaceholder: "Enter your password",
+ confirmPasswordPlaceholder: "Confirm your password",
+ createAccount: "Create Account",
+ alreadyHaveAccount: "Already have an account?",
+ dontHaveAccount: "Don't have an account?",
+ invalidEmail: "Please enter a valid email",
+ passwordRequired: "Password is required",
+ passwordTooShort: "Password must be at least 8 characters",
+ passwordsDoNotMatch: "Passwords do not match",
+ signInError: "Unable to sign in. Please check your credentials.",
+ signUpError: "Unable to create account. Please try again.",
+ loadingAlerts: "Loading alerts...",
+ allClearTitle: "All clear!",
+ noAlertsToReview: "No alerts to review right now.",
+ reviewPill: "Review",
+ fyiPill: "FYI",
+ whatHappened: "What happened",
+ whyItMatters: "Why it matters",
+ suggestedNextStep: "Suggested next step",
+ noDeviceSelected: "No device selected. Please link a device first.",
+ disableBuddy: "Disable Buddy",
+ temporarilyDisablesBuddy: "Temporarily disables Buddy.",
+ contentBlocking: "Content blocking",
+ adultSites: "Adult sites",
+ blockAdultWebsites: "Block adult websites.",
+ familyLink: "Family Link",
+ antiCircumvention: "Anti-Circumvention",
+ preventFamilyLinkBypasses:
+ "Measures that prevent certain Family Link bypasses.",
+ communication: "Communication",
+ communicationWithStrangers: "Communication with strangers",
+ blockAllCommunications: "Block all communications",
+ scanCommunicationsWithAI: "Scan communications with AI",
+ chooseHowBuddyShouldHandleStrangers:
+ "Choose how Buddy should handle strangers.",
+ communicationWithStrangersTitle: "Communication with strangers",
+ blockAllCommunicationsConfirm:
+ "This will notify of all comms with strangers.",
+ okay: "Okay",
+ cancel: "Cancel",
+ notifications: "Notifications",
+ dangerousMessages: "Dangerous messages",
+ newContactAdded: "New contact added",
+ devices: "Devices",
+ device: "device",
+ devicesPlural: "devices",
+ lastSeen: "Last seen",
+ online: "Online",
+ offline: "Offline",
+ transparency: "Transparency",
+ privacyAndTerms: "Privacy & terms",
+ legalAndPrivacyInfo: "Legal and privacy info.",
+ account: "Account",
+ verifyEmail: "Verify E-Mail",
+ verifyYourEmailAddress: "Verify your email address.",
+ signOut: "Sign Out",
+ notWiredYet: "Not wired yet",
+ hookThisUpLater: "Hook this up later.",
+ renameDevice: "Rename Device",
+ enterNewNameFor: "Enter a new name for",
+ verifyEmailTitle: "Verify Email",
+ enterVerificationCode: "Enter the verification code sent to your email:",
+ success: "Success",
+ error: "Error",
+ emailVerifiedSuccessfully: "Email verified successfully!",
+ failedToVerifyEmail: "Failed to verify email",
+ newContactAddedTitle: "New Contact Added",
+ newContactAddedSubtitle: "A new contact was added to a device",
+ contactName: "Contact Name",
+ unknown: "Unknown",
+ phoneNumber: "Phone Number",
+ emailAddress: "Email Address",
+ identifier: "Identifier",
+ notProvided: "Not provided",
+ unknownDevice: "Unknown Device",
+ contactAddedInfo:
+ "This contact was added to {deviceName}. You can review it in the device's contact list.",
+ backToHome: "Back to Home",
+ noDeviceSelectedPleaseLinkFirst:
+ "No device selected. Please link a device first.",
+};
+
+const hr: typeof en = {
+ home: "Početna",
+ alerts: "Upozorenja",
+ controls: "Kontrole",
+ settings: "Postavke",
+ allClear: "Sve je u redu",
+ attentionNeeded: "Potrebna pažnja",
+ captchaError: "Neuspjela provjera Captcha. Pokušajte ponovno.",
+ today: "Danas",
+ review: "Pregled",
+ nothingNeedsAttention: "Ništa ne zahtijeva pažnju.",
+ fewItemsNeedReview: "Nekoliko stavki treba pregled.",
+ deviceIsOnline: "Uređaj je na mreži",
+ deviceIsOffline: "Uređaj je izvan mreže",
+ protectionActive: "Zaštita je aktivna.",
+ reconnectingAutomatically: "Automatsko ponovno povezivanje.",
+ recentAlerts: "Nedavna upozorenja",
+ last24Hours: "Zadnja 24 sata",
+ thisWeek: "Ovaj tjedan",
+ needsAction: "zahtijeva radnju",
+ reviewed: "pregledano",
+ // Onboarding & Auth
+ welcomeTitle: "Dobrodošli u Buddy",
+ welcomeSubtitle:
+ "Zaštitite svoju obitelj na internetu uz pametne roditeljske kontrole.",
+ getStarted: "Započni",
+ signIn: "Prijava",
+ signUp: "Registracija",
+ email: "E-mail",
+ password: "Lozinka",
+ confirmPassword: "Potvrdite lozinku",
+ emailPlaceholder: "Unesite svoj e-mail",
+ passwordPlaceholder: "Unesite svoju lozinku",
+ confirmPasswordPlaceholder: "Potvrdite svoju lozinku",
+ createAccount: "Izradi račun",
+ alreadyHaveAccount: "Već imate račun?",
+ dontHaveAccount: "Nemate račun?",
+ invalidEmail: "Unesite valjanu e-mail adresu",
+ passwordRequired: "Lozinka je obavezna",
+ passwordTooShort: "Lozinka mora imati najmanje 8 znakova",
+ passwordsDoNotMatch: "Lozinke se ne podudaraju",
+ signInError: "Prijava nije uspjela. Provjerite podatke.",
+ signUpError: "Registracija nije uspjela. Pokušajte ponovno.",
+ loadingAlerts: "Učitavanje upozorenja...",
+ allClearTitle: "Sve je u redu!",
+ noAlertsToReview: "Trenutno nema upozorenja za pregled.",
+ reviewPill: "Pregled",
+ fyiPill: "Informacija",
+ whatHappened: "Što se dogodilo",
+ whyItMatters: "Zašto je važno",
+ suggestedNextStep: "Predloženi sljedeći korak",
+ noDeviceSelected: "Nije odabran uređaj. Najprije povežite uređaj.",
+ disableBuddy: "Onemogući Buddy",
+ temporarilyDisablesBuddy: "Privremeno onemogućuje Buddy.",
+ contentBlocking: "Blokiranje sadržaja",
+ adultSites: "Stranice za odrasle",
+ blockAdultWebsites: "Blokiraj web-stranice za odrasle.",
+ familyLink: "Family Link",
+ antiCircumvention: "Protiv zaobilaženja",
+ preventFamilyLinkBypasses:
+ "Mjere koje sprječavaju određene zaobilaske Family Linka.",
+ communication: "Komunikacija",
+ communicationWithStrangers: "Komunikacija sa strancima",
+ blockAllCommunications: "Blokiraj sve komunikacije",
+ scanCommunicationsWithAI: "Skeniraj komunikacije pomoću AI",
+ chooseHowBuddyShouldHandleStrangers:
+ "Odaberite kako Buddy treba postupati sa strancima.",
+ communicationWithStrangersTitle: "Komunikacija sa strancima",
+ blockAllCommunicationsConfirm:
+ "Ovo će obavještavati o svim komunikacijama sa strancima.",
+ okay: "U redu",
+ cancel: "Odustani",
+ notifications: "Obavijesti",
+ dangerousMessages: "Opasne poruke",
+ newContactAdded: "Dodan novi kontakt",
+ devices: "Uređaji",
+ device: "uređaj",
+ devicesPlural: "uređaji",
+ lastSeen: "Zadnje viđeno",
+ online: "Na mreži",
+ offline: "Izvan mreže",
+ transparency: "Transparentnost",
+ privacyAndTerms: "Privatnost i uvjeti",
+ legalAndPrivacyInfo: "Pravne i privatnosne informacije.",
+ account: "Račun",
+ verifyEmail: "Potvrdi e-mail",
+ verifyYourEmailAddress: "Potvrdite svoju e-mail adresu.",
+ signOut: "Odjava",
+ notWiredYet: "Još nije povezano",
+ hookThisUpLater: "Povežite ovo kasnije.",
+ renameDevice: "Preimenuj uređaj",
+ enterNewNameFor: "Unesite novo ime za",
+ verifyEmailTitle: "Potvrdite e-mail",
+ enterVerificationCode: "Unesite verifikacijski kod poslan na vaš e-mail:",
+ success: "Uspjeh",
+ error: "Greška",
+ emailVerifiedSuccessfully: "E-mail je uspješno potvrđen!",
+ failedToVerifyEmail: "Neuspjela potvrda e-maila",
+ newContactAddedTitle: "Dodan novi kontakt",
+ newContactAddedSubtitle: "Na uređaj je dodan novi kontakt",
+ contactName: "Ime kontakta",
+ unknown: "Nepoznato",
+ phoneNumber: "Telefonski broj",
+ emailAddress: "E-mail adresa",
+ identifier: "Identifikator",
+ notProvided: "Nije navedeno",
+ unknownDevice: "Nepoznati uređaj",
+ contactAddedInfo:
+ "Ovaj kontakt je dodan na {deviceName}. Možete ga pregledati na popisu kontakata uređaja.",
+ backToHome: "Natrag na početnu",
+ noDeviceSelectedPleaseLinkFirst:
+ "Nije odabran uređaj. Najprije povežite uređaj.",
+};
+
+type Locale = "en" | "hr";
+
+export const locales: Record<Locale, typeof en> = {
+ en,
+ hr,
+} as const;
+
+export type LocaleKey = keyof typeof en;
+
+export const getCurrentLocale = (): Locale => {
+ const currentLocale = getLocales()[0]?.languageTag || "en";
+ return currentLocale.startsWith("hr") ? "hr" : "en";
+};
+
+export const t = (key: LocaleKey): string => {
+ const locale = getCurrentLocale();
+ return locales[locale][key] || locales.en[key] || key;
+};