Skip to content

Improving translation system #64

@felixgirault

Description

@felixgirault

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions