Skip to content

Instantly share code, notes, and snippets.

@morficus
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save morficus/4bc91adf7d3c56a2d6b2 to your computer and use it in GitHub Desktop.

Select an option

Save morficus/4bc91adf7d3c56a2d6b2 to your computer and use it in GitHub Desktop.
Ghost Blog i18n proof of concept

These instructions are intended help anyone who is interested in demo'ing the Ghost i18n proof-of-concept (or PoC) that I am throwing together. This PoC is for both the admin panel as well as server-side notifications.

See the POC in action

  1. Clone Ghost from my fork on GitHub
  2. Switch over to the i18n-poc branch (git checkout i18n-poc)
  3. Run npm install to download all node-related dependencies.
  4. Now follow the regular Ghost "developer install from git" instructions. https://github.com/TryGhost/Ghost#developer-install-from-git
  5. Once you are done with the those instructions, grunt dev` to start Ghost in development mode. Ghost will then be running at http://localhost:2368/ghost/
  6. Because this is just a proof of concept, the language files are inlcuded as part of the repo (in the real world, this would not be the case)
  7. Also because this is just a PoC... only a small subset of items have been translated:
  • Main navigation in the admin panel
  • Settings --> About page (also in the admin panel)
  • Initial notifications when you first run the blog (the "Welcome to Ghost" and "Trying to send an email" ones)
  • The "Welcome to Ghost" email
  1. To force another locale, open /core/client/app/app.js and change the array on line 18n to only have a single locale of your choice (currently the only ones avilable are en and es)

How does it work

Client-side

As you probablly already guessed, /core/client/app/app.js is where the locale is being set. This is thanks to the ember-intl library (which is part of formatjs

Server-side

In nodeJS-land I'm using intl-messageformat

Files you may care about:

If you want to see all files that were changed then take a look at this commit for al lthe client-side stuff and this commit for all the server-side stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment