JS Internationalisation using i18next #4515
Replies: 5 comments
-
|
We will need tools to make the conversion. (I have similar tools I already use to create the .INI file for webi10n.js.) And we still need to maintain the PO files themselves. |
Beta Was this translation helpful? Give feedback.
-
|
Subject: GSOC 2025 Plan – Modernizing JS Internationalization in Music Blocks Hi @walterbender, I hope you’re doing well. I’d like to work on the JS Internationalization project idea listed on the Sugar Labs ideas page. Although the idea is already present, I’m eager to contribute and have prepared a detailed strategy, research overview, and implementation plan. Below is my proposed approach: 1. Research & BackgroundCurrently, our JavaScript activities rely on the somewhat antiquated webL10n.js library. This library lacks critical features—such as pluralization and locale-specific formatting—which modern applications require. My research has focused on:
2. Proposed StrategyMy strategy centers on maintaining our existing translation workflow (using PO files and a centralized
3. Implementation PlanPhase 1: Research and Framework Evaluation (≈25 hours)
Phase 2: Planning and Design (≈25 hours)
Phase 3: Implementation (≈100 hours)
Phase 4: Documentation and Finalization (≈25 hours)
4. DiagramsArchitecture Diagramgraph TD;
A[localization.ini] --> B[Config Parser];
B --> C[i18next Initialization];
C --> D[PO File Loader];
D --> E[PO-to-JSON Converter];
E --> F[JSON Cache];
F --> G[Runtime Translation Lookup];
|
Beta Was this translation helpful? Give feedback.
-
|
I would appreciate your feedback on the following:
|
Beta Was this translation helpful? Give feedback.
-
|
I am not sure that localization.ini is a good basis of any framework going forward as it is a lossy representation of the PO file content and it doesn't support language features such as plurals management. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @walterbender, Thanks for your feedback. I completely understand your concern about using localization.ini as a basis since it doesn't capture the full fidelity of the PO file content—especially regarding advanced language features like plural management. My intent was to use localization.ini strictly as a configuration file to set global parameters (such as defaultLocale, fallbackLocale, and the location of our PO files) rather than as a source for translation data. The actual translation content—including plurals, context, and other language-specific details—would be fully parsed from the PO files and then converted to JSON. This JSON cache would be designed to retain all the necessary data for i18next to manage plurals and other language nuances. That said, I see the value in exploring alternatives where we minimize any potential data loss. One possibility might be to either extend the configuration file to include more detailed language rules or to rely solely on the PO files for translations while using a separate configuration mechanism for global settings. I’m very open to suggestions on how best to achieve this while ensuring full support for language features. I’d love to discuss this further to refine the approach. Thanks again for your guidance! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Discussion: Is Converting PO Files to JSON Using po2json the Right Approach for i18n?
Hi everyone,
I’ve been exploring ways to modernize our internationalization workflow and came across the [po2json](https://www.npmjs.com/package/po2json) npm package. My idea is to convert our existing PO files into JSON so that we can configure and use i18next (or a similar i18n library) more seamlessly.
My question is:
Is it correct to do this? Are there any potential pitfalls or concerns with using po2json to convert our PO files to JSON, or does this approach sound robust enough for our needs?
I’d appreciate any insights or experiences you have with this conversion process. Also, @walterbender, could you please share your thoughts on whether this is the right strategy for our project?
--- @walterbender
Beta Was this translation helpful? Give feedback.
All reactions