Send files directly between devices over the internet - no cloud storage, no size limits.
TypeScript cross-platformdata-transferdecentralizedfile-sharingfile-transferhole-punchingopen-sourcep2ppeer-to-peerprivacyprivacy-tools
@altersend/locales
Shared internationalization infrastructure for AlterSend desktop and mobile.
Contracts
- Locale codes are concrete BCP 47-style codes such as
en-US,pt-BR, andja-JP. - Saved locale state is app-owned and uses
LocalePreference = 'system' | SupportedLocaleCode. resolveLocalePreference(preference, systemLocales)converts saved preference plus system locales into the active concrete locale, falling back toen-USwhen nothing matches.packages/domainstays runtime-agnostic and does not import i18next.
Catalogs
Resources live in src/locales/<locale>/ and are split by namespace:
commonsendreceivesettingsonboardingfeedbackerrorsnative
Every locale must keep the same namespace and key set as en-US. Resource tests reject missing keys, empty strings, missing plural forms, and untranslated English leftovers outside the explicit allowlist.
Usage
import { useTranslation } from '@altersend/locales'
function Header() {
const { t } = useTranslation(['send'])
return <h1>{t('send:page.select.title')}</h1>
}
Outside React, use i18nextInstance or the package helpers:
import { changeI18nLanguage, initI18n, resolveLocalePreference } from '@altersend/locales'
await initI18n(resolveLocalePreference(savedPreference, systemLocales))
await changeI18nLanguage('en-US')
Adding A Locale
- Add the locale to
SUPPORTED_LOCALESinsrc/locale.ts. - Add translated namespace files under
src/locales/<locale>/. - Register the resources in
src/resources.ts. - Add native metadata in the
nativenamespace when needed. - Run the locale tests before exposing the language.