Localisation support


Could not find in documentation - is there any built in support for translation/localisation? I’d like to be able to detect preferred language and ship .po files with my package

How to add a language?
Localization available?
How to switch Atom to another language

I’ve been digging into the core code (v0.75.0) trying to figure it out; but, at this point in time, it looks like there are no I18N mechanisms.

For example, MenuManager (Atom.app/Contents/Resources/app/src/menu-manager.js) needs some major surgery. Right now each menu is identified by its name in English, which is also used for its text. For example, if you were to change the name of the “Packages” menu inside Atom.app/Contents/Resources/app/menus/darwin.json, then packages that add their own sub-menus to the "Packages" menu cause a new menu (called “Packages”) to be created. Menu IDs need to be separated from their text.

As for within your own packages, though, you can do whatever you want. It looks like navigator.language always returns "en-US", though, and process.env.LANG is undefined when run from Finder or spotlight. So, you’ll need to depend on config values and convert strings by yourself.

L10N preferences could be put into a common config (such as i18n.languages), which could be an Array of language tags ordered from most to least preferred. When no preferred languages have been specified, the packages could then use their default language.

It would be nice to see some I18N functionality in the core; but, I think the priority is low as of yet.


I’ve got a working Proof of Concept of internationalized & localized to Japanese (with option of other languages) for Atom v0.76.0. I threw together a module that has to sit in Atom.app/Contents/Resources/app/node_modules/, that takes care of loading .po files, but it doesn’t support any pluralization.

Each package can then use something like atom.i18n.getDomain('l10n-example') to get at their own domains. Each domain is, by convention, in a directory /po/language-id/domain.po inside the package’s base (at the same level as /lib/, /keymaps/, etc.). Something like this:

[l10n-example]$ tree
├── LICENSE.md
├── README.md
├── lib
│   └── l10n-example.coffee
├── menus
│   └── l10n-example.cson
├── package.json
├── po
│   ├── ja
│   │   └── l10n-example.po
│   └── l10n-example.pot
└── spec
    └── l10n-example-spec.coffee

5 directories, 8 files

It works pretty good, though, even if it is just a hack on the internals of Atom.app. It depends on process.env.LANG and navigator.language returning the correct locale information, too. I literally had to perform binary surgery on the libchromiumcontent.dylib packaged inside Atom in order to change navigator.language's value—even then, only statically. As I mentioned before, $LANG does get properly set when you run the atom command from the shell.

Anyway, here’s a screenshot of my progress (note that the “Help” menu gets broken for some reason). I also modified the feedback and release-notes packages to have their own .po files :smile:


I have created a package for this.
You can install it through Preferences by searching for ‘localization’



I looked at your package. As far as I can tell, all it does is just translate the system menus based on their label (which is a problem that I have touched on above). The translation routine actually gets executed twice: once after 300ms; and then again after 1000ms. It also looks like the package does not handle context menus, text within packages, nor menus which packages add to the “Packages” menu (unless the strings are added to your translation files).

I believe that the OP was asking for a standardized I18N framework that could be used with .po files for their own package(s). Your package does not appear to provide such a mechanism (which I think would need to be provided by the core, anyway).


Can’t find the package. Helping hand needed.
Thanks in advance :wink:



I have started work on adding i18n support to Atom’s core! String extraction happens on-the-fly when Atom is in debug mode (i.e., atom -d).

I think that using .po files directly is not the way to go; so, my implementation uses CSON/JSON for simplicity. You could conceivably make a .po -> CSON conversion step in your build.

I have also started translation of the Feedback and Settings modules.

The automatic locale detection is lacking on OSX (I have not tried on any other OSs). Executing Atom from the command line gives it the proper environment. You can do something like this:

$ env LANG=ja_JP atom -d