Skip to content
This repository has been archived by the owner on Apr 21, 2019. It is now read-only.

Latest commit

 

History

History
50 lines (31 loc) · 1.55 KB

LOCALISATION.md

File metadata and controls

50 lines (31 loc) · 1.55 KB

Rabix Editors Localisation

l10n Files

Localisation relies on the l10n files found in frontend/l10n. There are two files for the Rabix editors, frontend/l10n/cgc/editors/editors.l10n and frontend/l10n/sbg/editors/editors.l10n. Obviously, one is for CGC and the other for SBG. Files should be added with new environments. Right now, the two files are literally 99.56% identical, and differ only in the content of the variables.

These files are loaded dynamically by Camellia based on the environment. For the editors, app-edit.html does this through the localisation block:

{% block localisation %}
    <script type="application/l20n" src="{{ STATIC_URL }}l10n/{{ localisation }}/editors/editors.l10n?bust={{ bust }}"></script>
{% endblock localisation %}

These files follow a simple syntax, you can learn more about how to write them from the official documentation.

angular wrapper

The angular filter loc serves as a wrapper around the document.l10n.getSync method.

Let's say our l10n file looks like this:

<idOfLocalisedItem[$number] {
	one: "一"
	two: "二"
	three: "三"
}>

It can be used inside html/templates:

<p>{{ :: 'idOfLocalisedItem' | loc:{number: 'two' }}</p>

Don't forget the double colon :: for single binding. These values are static and should not be watched!

or in angular code using the $filter service:

angular.module('app').controller('Ctrl', ['$filter', function($filter) {

	var localised = $filter('loc')('idOfLocalisedItem', {number: 'two'});
	
}]);