Skip to content

Commit

Permalink
Merge pull request #3798 from openstreetmap/language-debugging
Browse files Browse the repository at this point in the history
Add _tkeys_ language for translation debugging
  • Loading branch information
bhousel authored Jan 27, 2017
2 parents ad06e34 + 2ab4e59 commit fecff19
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/core/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ export function setAreaKeys(value) {


export function coreContext() {

// create a special translation that contains the keys in place of the strings
var tkeys = _.cloneDeep(dataEn);
var parents = [];

function traverser(v, k, obj) {
parents.push(k);
if (_.isObject(v)) {
_.forOwn(v, traverser);
} else if (_.isString(v)) {
obj[k] = parents.join('.');
}
parents.pop();
}

_.forOwn(tkeys, traverser);
addTranslation('_tkeys_', tkeys);

addTranslation('en', dataEn);
setLocale('en');

Expand Down

0 comments on commit fecff19

Please sign in to comment.