-
Notifications
You must be signed in to change notification settings - Fork 2
Implement and improve i18n fallbacks and sounder integration #16
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
Conversation
|
Thanks for the contribution! How does this handle a string not existing in a locale? I will admit translation isn't something I've implemented before. How would you envision it regressing? // EN
t('something.new') // "Something New"
// PL
t('something.new') // "Something New" (using fallback locale)
// or
t('something.new') // "MISSING" or a full on throw?It doesn't feel right to me put English into the Polish locale to cover the untranslated case. |
| if (!key || typeof key !== 'string') { | ||
| return Response.json({error: 'missing key'}, {status: 400}) | ||
| } | ||
|
|
||
| if (!message || typeof message !== 'string') { | ||
| return Response.json({error: 'missing message'}, {status: 400}) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of returning error to the sounder instead of just throwing an invariant error. I'd say its outside the scope of this PR to update the rest of the sounder API to the same, and implement it in the sounder.
|
@Arcath the default fallback locale is English. I believe it's okay, better have English text than a key. Today is the first day I launched the OSB in my kids school, great job! I can contribute to translation if needed as I'll be maintaining the one installed instance for a while - 3yrs horizon. |
…y missing keys from it
|
I've tweaked it slightly to implement that, it was outputting the key originally. I've re-based the PR onto |
|
Great to hear that another school is using OSB! |
* feat: set version const to 1.4.0 * feat: Implement and improve i18n fallbacks and sounder integration (#16) * Implement i18n integration across routes and components. * Refactor calendar month localization to use i18n keys. * Add i18n support for log messages in log route. * fix: apply prettier * fix: add missing type to meta function * fix(lint): address some lint warnings * feat: type the translation key off the fallback locale and load in any missing keys from it * fix(ts): fix typings that use MessageKey --------- Co-authored-by: Adam Laycock <adam@alaycock.co.uk> Co-authored-by: AML - A Laycock <aml@lhs.lancs.sch.uk> * feat: implement new sounder api responses * feat: audio sequences for schedule (#19), closes #2 * feat: audio sequences on schedule, see #2 * feat: update sounder api to handle sequences instead * fix: locale is a partial * feat: add copy/paste to sequence builder, closes #2 * fix: add method to delete sounders, closes #18 --------- Co-authored-by: Michał Marcin Brzuchalski <michal.brzuchalski@gmail.com>
Summary