Skip to content

Conversation

@brzuchal
Copy link
Contributor

@brzuchal brzuchal commented Oct 19, 2025

Summary

  • i18n locales are used to translate the interface of a program into polish language
  • guard the root layout with locale fallbacks so SSR never dereferences missing loader data
  • filter broadcast queues and harden sounder APIs to prevent undefined audio paths and bad requests
  • localise calendar month labels through translation keys
  • translate common log entries for better readability

@Arcath Arcath added the enhancement New feature or request label Oct 19, 2025
@Arcath
Copy link
Contributor

Arcath commented Oct 19, 2025

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.

Comment on lines +11 to +17
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})
}
Copy link
Contributor

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.

@brzuchal
Copy link
Contributor Author

@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.

@Arcath Arcath changed the base branch from main to release/1.4.0 October 20, 2025 18:51
@Arcath
Copy link
Contributor

Arcath commented Oct 20, 2025

I've tweaked it slightly to implement that, it was outputting the key originally.

I've re-based the PR onto Release 1.4.0 So I can bundle it into that release.

@Arcath
Copy link
Contributor

Arcath commented Oct 20, 2025

Great to hear that another school is using OSB!

@Arcath Arcath merged commit e119e20 into Open-School-Bell:release/1.4.0 Oct 20, 2025
4 of 5 checks passed
Arcath added a commit that referenced this pull request Oct 21, 2025
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants