Translators can easily add a new language, where they can translate LoopBack docs.
Page Contents


When you want to add a language that doesn’t yet exist on the site, you have to follow a few additional steps to set it up.


In this procedure, xx represents the ISO language code for the language (for example, fr for French, de for German, and so on).

  • Create new directory for your translated pages: /pages/xx/lb2
  • If you have any translated pages, copy them into that directory.
  • Copy the English navigation sidebar _data/sidebars/lb2_sidebar.yml (assuming you want to start with LoopBack version 2.x). Name it _data/sidebars/xx_sidebar.yml.
  • Edit the sidebar as described below in Configuring the localized sidebar.
  • Add sidebar to _config.yml to the list in the sidebars property.
  • Add sidebar to _includes/custom/sidebarconfigs.html as follows:
{% elsif page.sidebar == "xx_lb2_sidebar" %}
    {% assign sidebar = %}
  • Add to _data/topnav.yml (under the title: Translations list).
  • Add a file named to page/xx/lb2 with the content shown below. This page is displayed when someone clicks on a sidebar link for page that hasn’t yet been translated:
title: 'Not yet translated'
lang: xx
layout: stub
sidebar: xx_lb2_sidebar
permalink: /doc/xx/lb2/Not-yet-translated.html

For instructions on how to translate, see [Translating articles](Translating_articles.html).
  • Ensure all translated pages have the proper front matter; for example:
lang: xx
layout: translation
keywords: ...
sidebar: xx_lb2_sidebar
permalink: /doc/xx/lb2/Access-token-REST-API.html

Note the translation layout. This adds the translation disclaimer at the top of the page.

Best practices is not to put untranslated English pages in the localized directory pages/xx/lb2, except for the “front page”; even if you haven’t translated this page, you can include some text in the target language stating that translation into the language is underway.

Configuring the localized sidebar

The localized (translated) sidebar file, _data/sidebars/xx_sidebar.yml, has the same format as the English sidebar YAML file, but with a few changes and additions.

Edit the English sidebar as follows:

  • Change all occurrences in the url property of /en/ to /xx/. Leave the file names the same; only change the directory name.
  • Change the top-level properties in the file as follows:
title: Loopback 2.0 - <Add language name here>
url: /doc/xx/lb2/index.html
translated: true
  • For each translated article, add the translated: true property for the article in the sidebar file. For example, in the Japanese sidebar:
- title: 'LoopBack コアコンセプト'
  url: /doc/ja/lb2/LoopBack-core-concepts.html
  translated: true
  • Translate titles as desired. Best practice is to translate the sidebar titles only when you translate the article, since that provides readers a clue about what’s been translated and what has not.

Importing existing translations

As discussed in issue #37, there is some translated content on the old doc site. When using the migration script to convert this content to HTML, you have to do a few extra things:

  1. Fix all links; If “xx” is the ISO language code for the language, replace:
    • Links to with link to translated page on
    • Links to with link to translated page on
    • Links to /doc/en/lb2/Foo.html with Foo.html.
  2. Change front matter as described above.

File names

In general, translations should use the same file name as the English content, but just kept in a different directory (e.g. pages/fr/lb2 instead of pages/en/lb2). It seems that conversion of some translated files does not convert the file names properly, so you may need to go through and manually rename some files and make corresponding changes in the sidebar nav .yml file and possibly also to links to such files.


Due to the way that translated content was stored in Confluence, the migration will unfortunately create an entirely separate set of image files (and markdown referring to the image files). However, we don’t want to have duplicates of every image file for each language, so we also need to replace the image references to use the existing image files.