Skip to content

Commit

Permalink
Embedded localization strings and published new NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevenic committed Dec 4, 2017
1 parent 5753705 commit b256b2a
Show file tree
Hide file tree
Showing 15 changed files with 446 additions and 217 deletions.
33 changes: 16 additions & 17 deletions Node/core/lib/DefaultLocalizer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Library_1 = require("./bots/Library");
var systemResources = require("./systemResources");
var logger = require("./logger");
var consts = require("./consts");
var fs = require("fs");
Expand Down Expand Up @@ -195,24 +196,22 @@ var DefaultLocalizer = (function () {
DefaultLocalizer.prototype.loadSystemResources = function (locale) {
var _this = this;
return new Promise(function (resolve, reject) {
var access = Promise.denodeify(fs.access);
var dir = path.join(Library_1.systemLib.localePath(), locale);
var filename = Library_1.systemLib.name + '.json';
var filepath = path.join(dir, filename);
access(filepath)
.then(function () {
return _this.parseFile(locale, dir, filename);
})
.done(function (count) { return resolve(count); }, function (err) {
if (err.code === 'ENOENT') {
logger.debug("localizer.loadSystemResources(%s) - Couldn't find file: %s", locale, filepath);
resolve(-1);
var entries = systemResources.locales[(locale || '').toLowerCase()];
if (entries) {
var cnt = 0;
var table = _this.locales[locale];
var ns = Library_1.systemLib.name.toLocaleLowerCase();
for (var key in entries) {
var k = _this.createKey(ns, key);
table.entries[k] = entries[key];
++cnt;
}
else {
logger.error('localizer.loadSystemResources(%s) - Error: %s', locale, err.toString());
reject(err);
}
});
resolve(cnt);
}
else {
logger.debug("localizer.loadSystemResources(%s) - Locale not supported.", locale);
resolve(-1);
}
});
};
DefaultLocalizer.prototype.createKey = function (ns, msgid) {
Expand Down
24 changes: 0 additions & 24 deletions Node/core/lib/locale/de/BotBuilder.json

This file was deleted.

26 changes: 0 additions & 26 deletions Node/core/lib/locale/en/BotBuilder.json

This file was deleted.

16 changes: 0 additions & 16 deletions Node/core/lib/locale/es/BotBuilder.json

This file was deleted.

19 changes: 0 additions & 19 deletions Node/core/lib/locale/fr/BotBuilder.json

This file was deleted.

16 changes: 0 additions & 16 deletions Node/core/lib/locale/it/BotBuilder.json

This file was deleted.

16 changes: 0 additions & 16 deletions Node/core/lib/locale/nl/BotBuilder.json

This file was deleted.

16 changes: 0 additions & 16 deletions Node/core/lib/locale/pt/BotBuilder.json

This file was deleted.

16 changes: 0 additions & 16 deletions Node/core/lib/locale/ru/BotBuilder.json

This file was deleted.

16 changes: 0 additions & 16 deletions Node/core/lib/locale/tr/BotBuilder.json

This file was deleted.

16 changes: 0 additions & 16 deletions Node/core/lib/locale/zh-Hans/BotBuilder.json

This file was deleted.

Loading

0 comments on commit b256b2a

Please sign in to comment.