Skip to content

Take the list of languages into account dynamically#504

Merged
AerunDev merged 8 commits intodevelopfrom
499-take-the-list-of-languages-into-account-dynamically
May 8, 2025
Merged

Take the list of languages into account dynamically#504
AerunDev merged 8 commits intodevelopfrom
499-take-the-list-of-languages-into-account-dynamically

Conversation

@Otaku17
Copy link
Collaborator

@Otaku17 Otaku17 commented May 7, 2025

Description

This PR introduces a more robust i18n system that separates active and inactive languages using a new format in package.json.
The updated structure allows finer control over which translation files are loaded into the application and ensures the JSON files remain in sync.

Close #499

Changes include:

  • package.json now defines languages as an object with boolean values ({ "fr": true, "de": false, ... })
  • i18n updater script:
    • Updates or creates .json files for all referenced languages.
    • Loads and syncs only languages marked true.
    • Skips loading languages marked false but still creates or updates their .json files.
    • Deletes .json files not listed in package.json.
  • Frontend i18n config:
    • Dynamically loads only the active (true) language files.
    • Ensures en.json is always used as the fallback.

Note before testing

Make sure package.json contains the new languages format:

"languages": {
  "en": true,
  "fr": true,
  "de": false,
  ...
}

Tests to perform

  • Confirm that only languages marked as true in package.json are loaded at runtime.
  • Verify that all translation files (both true and false) are correctly created and synchronized with en.json.
  • Ensure that any .json files not listed in package.json are removed.
  • Temporarily change a language from false to true and verify it begins loading correctly.
  • Confirm that no error is thrown if a false language file exists but is not loaded.

Otaku17 added 7 commits May 6, 2025 17:45
Ajout de la génération dynamique d'une nouvelle langue si ajouter au tableau et suppression si celle-ci n'est plus présente dans celui-ci
Returns to console when a key is not found
Update block commentary
json' loading logic changed.

Language list moved to package.json.
@Otaku17 Otaku17 linked an issue May 7, 2025 that may be closed by this pull request
@AerunDev AerunDev changed the title 499 take the list of languages into account dynamically Take the list of languages into account dynamically May 7, 2025
@AerunDev AerunDev merged commit 98d296b into develop May 8, 2025
5 checks passed
@AerunDev AerunDev deleted the 499-take-the-list-of-languages-into-account-dynamically branch May 8, 2025 20:49
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.

Take the list of languages into account dynamically

3 participants