Skip to content

feat: add i18n translations (es-ES, pt-PT)#67

Open
Cubel89 wants to merge 2 commits intoBowserinator:masterfrom
Cubel89:master
Open

feat: add i18n translations (es-ES, pt-PT)#67
Cubel89 wants to merge 2 commits intoBowserinator:masterfrom
Cubel89:master

Conversation

@Cubel89
Copy link
Copy Markdown

@Cubel89 Cubel89 commented Mar 31, 2026

What this PR adds

Internationalization (i18n) support for the periodic table data through separate translation files, without modifying any existing files.

Structure

A new i18n/ directory with:

  • README.md — Documentation and contribution guide
  • en-US.json — English (United States)
  • en-GB.json — English (United Kingdom)
  • es-ES.json — Spanish (Spain)
  • es-AR.json — Spanish (Argentina)
  • pt-PT.json — Portuguese (Portugal)

Each translation file includes:

  • Element names (all 119 elements)
  • Categories (all 15 categories)
  • Phases (Gas, Liquid, Solid)
  • Summaries (all 119 element descriptions)
  • Appearances (all 59 unique appearance values)

All translations are indexed by atomic number and use the original English values as keys for categories, phases, and appearances.

Why separate files?

  • Zero changes to existing files — no risk of breaking current consumers
  • Easy to contribute: one file per language, no merge conflicts between translators
  • Scales well: adding a new language is just adding a new file
  • Follows standard i18n patterns used across the industry

Language-specific highlights

  • en-US / en-GB: Consistent spelling for each variant (Aluminum vs Aluminium, color vs colour, gray vs grey)
  • es-ES: Official IUPAC Spanish nomenclature (RAE)
  • es-AR: Rioplatense Spanish voice, independently translated from English (not adapted from es-ES)
  • pt-PT: European Portuguese conventions (e.g., "Azoto" for Nitrogen, not Brazilian "Nitrogénio")

How to use

const elements = require('./PeriodicTableJSON.json');
const esES = require('./i18n/es-ES.json');                                                                                                                                     
                                                                                                                                                                               
const hydrogen = elements.elements[0];                                                                                                                                         
const name_es = esES.names[String(hydrogen.number)]; // "Hidrógeno"                                                                                                            
const category_es = esES.categories[hydrogen.category]; // "no metal diatómico"                                                                                                
                                                                                                                                                                               
Quality                                                                                                                                                                        
                                                                                                                                                                               
- Official IUPAC nomenclature used for each language                                                                                                                           
- Native-quality writing, not machine translation
- All diacritics and special characters correct                                                                                                                                
- Each regional variant respects its own conventions                                                                                                                           
                                                                                                                                                                               
Contributing new languages                                                                                                                                                     
                                                                                                                                                                               
The i18n/README.md includes a complete guide for contributors who want to add new languages.

Cubel89 added 2 commits March 31, 2026 08:38
Add internationalization support with separate JSON files per language.
Initial translations: Spanish (Spain) and Portuguese (Portugal).
Each file includes names, categories, phases, summaries and appearances
for all 119 elements.
Add three new i18n translation files:
- en-US.json: American English (Aluminum, Cesium, color)
- en-GB.json: British English (Aluminium, Caesium, colour)
- es-AR.json: Spanish (Argentina) with rioplatense voice
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.

1 participant