Skip to content

Conversation

@afrepues
Copy link
Contributor

Summary of changes

The main changes allow for configuring I18n from tess.yml.

Motivation and context

This allows each deployment of TeSS to configure I18n without having to maintain local code customizations. This in turn is motivated by requirements of the National Training Discovery portal project of the Digital Research Alliance of Canada.

Screenshots

No visible changes.

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree
    to license it to the TeSS codebase under the
    BSD license.

This commit introduces a simpler way to configure I18n's fallbacks[1]
than Rails' provides, by adding a simple translation layer driven by
two `tess.yml` options. The driver for this is the need for easily
configuring region-specific locales in TeSS, while at the same time
providing for a future source of clean source of desired locales to
show in a UI chooser for users.

Though I18n has a configuration option for available locales (and
Rails too), locales not listed in that option won't be considered for
sources of translations.

[1] Fallback is a concept from I18n that allows to use translations
    from a more general locale than specified, e.g.: a request for a
    translation to locale "en-CA", if not found, will fallback to
    search the translations to "en".

    This enables using a region-specific locale to get easily
    localized dates, but still use the default translations files. It
    also allows to have region-specific with partial coverage
    (i.e.: customizations of some translations only).
This covers a specific case that might not apply to all I18n
users. Also, Rails already does this when `fallbacks` is `true`[1].

[1] https://github.com/rails/rails/blob/7-0-stable/activesupport/lib/active_support/i18n_railtie.rb#L102
Copy link
Member

@fbacall fbacall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

I'm just going to trust you have manually tested this using e.g. the rfc4646 fallback option with subtags, because we don't yet have a clean, automated way of testing using different configurations.

@fbacall fbacall merged commit 9e4add2 into ElixirTeSS:master Nov 28, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants