I think the translation system is not ideal, mainly because of those two points:
Bundle size
When using Orejime as a standalone script (for example from a CDN), translated strings for all supported languages are bundled with it, whether they're used or not.
A solution to that could be to extract translations for each language into separate js files that could be required individually.
Consistency
There is an overlap in the way translated strings are provided. Some are set in the configuration (like app or category titles and descriptions), while the rest comes from the translations object. In some instances, those two ways are mixed together:
var config = {
apps: [
{
name: "ad-tracker",
title: "Ad tracker"
}
],
translations: {
fr: {
'ad-tracker': {
title: 'Tracker publicitaire'
}
}
}
}
A cleaner solution could be to systematize the use of translated strings:
var config = {
apps: [
{
name: "ad-tracker",
- title: "Ad tracker"
}
],
translations: {
+ en: {
+ 'ad-tracker': {
+ title: 'Ad tracker'
+ }
+ },
fr: {
'ad-tracker': {
title: 'Tracker publicitaire'
}
}
}
}
While being more consistent, it would be a little more convoluted.
I think the translation system is not ideal, mainly because of those two points:
Bundle size
When using Orejime as a standalone script (for example from a CDN), translated strings for all supported languages are bundled with it, whether they're used or not.
A solution to that could be to extract translations for each language into separate js files that could be required individually.
Consistency
There is an overlap in the way translated strings are provided. Some are set in the configuration (like app or category titles and descriptions), while the rest comes from the
translationsobject. In some instances, those two ways are mixed together:A cleaner solution could be to systematize the use of translated strings:
var config = { apps: [ { name: "ad-tracker", - title: "Ad tracker" } ], translations: { + en: { + 'ad-tracker': { + title: 'Ad tracker' + } + }, fr: { 'ad-tracker': { title: 'Tracker publicitaire' } } } }While being more consistent, it would be a little more convoluted.