Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace i18next with something more suitable #720

Open
sluukkonen opened this issue Aug 11, 2020 · 0 comments
Open

Replace i18next with something more suitable #720

sluukkonen opened this issue Aug 11, 2020 · 0 comments

Comments

@sluukkonen
Copy link
Contributor

sluukkonen commented Aug 11, 2020

i18next is quite heavyweight and not particularly suitable for our use-cases. I think we could come up with a homegrown solution that would be

  1. More type safe
  2. More lightweight
  3. More suitable for our use-cases

Just a simple TypeScript object like

const translations: Translations {
  someTranslationKey: () => 'foo',
  otherTranslationKey: (bar: string) => 'foo' + bar
}

and an accompanying hook

const t = useTranslation() // Retrieves the proper Translation-object for the current language
const whatever = t.someTranslationKey() 
// Alternate API
const whatever = t('someTranslationKey') // take a `keyof Translations` as an argument

might be an improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant