I'll use a single ember-i18n translation file as an example
Characteristics of the file; it's deeply nested at times, has lots of comments, but is well laid out
Here's a snippet from /app/locales/en-au/translations.js
export default {
"common": {
"comingSoon": "Coming Soon",
"assetDetails": "Asset Details",
"close": "Close",
"history": "History",
"live": "Live",
"pagination": {
"prev": "Prev",
"next": "Next",
"pageOf": "Page {{number}} of {{total}}"
},
"loading": "Loading",
"sectionBreak": "Section Break",
"helpText": "Help Text",
"emptyChart": "No data to display",
"na": "N/A",
"all": "All",
"on": "On",
"off": "Off",
"disabled": "Disabled",
"mobile": "Mobile",
"tablet": "Tablet",
"ignition": "Ignition",
"bearings": {
"n": {
"code": "N",
"full": "North"
},
"s": {
"code": "S",
"full": "South"
},
"e": {
"code": "E",
"full": "East"
},
"w": {
"code": "W",
"full": "West"
},
"ne": {
"code": "NE",
"full": "North-East"
},
"nw": {
"code": "NW",
"full": "North-West"
},
"se": {
"code": "SE",
"full": "South-East"
},
"sw": {
"code": "SW",
"full": "South-West"
}
}
}
}
I decided that yaml is probably a better option for flexibility, so I ran this command
ember-i18n-intl-migrator --type=yaml
That gives an output file of /translations/en-au.json
The first problem I noticed is that the file is .json
rather than .yml
. Opening the file it looks like it has converted to YAML (output below) but I have a few suggestions;
- Comments don't seem to have been transferred across, is it possible to do this?
- My nests are now mostly on one line, after reaching the 2nd level, is it possible to keep the nesting?
- Translation text in the YAML file uses quotes "" for all translations that are multiple words, whereas it uses no quotes for single words. Can we use quotes also for single words?
/translations/en-au.json
common:
comingSoon: 'Coming Soon'
assetDetails: 'Asset Details'
close: Close
history: History
live: Live
pagination: {prev: Prev, next: Next, pageOf: 'Page {number} of {total}'}
loading: Loading
sectionBreak: 'Section Break'
helpText: 'Help Text'
emptyChart: 'No data to display'
na: N/A
all: All
on: On
off: Off
disabled: Disabled
mobile: Mobile
tablet: Tablet
ignition: Ignition
bearings: {n: {code: N, full: North}, s: {code: S, full: South}, e: {code: E, full: East}, w: {code: W, full: West}, ne: {code: NE, full: North-East}, nw: {code: NW, full: North-West}, se: {code: SE, full: South-East}, sw: {code: SW, full: South-West}}