@criticalmanufacturing/dev-i18n-transform
Version:
i18n <--> gettext transform
37 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const typescript_parser_1 = require("./typescript.parser");
const portableObject_parser_1 = require("./portableObject.parser");
class ParserFactory {
/**
* Gets the right analyser for the specified language.
*
* @param packageName Package name
* @param paths File paths to analyse
* @param language Language to analyse
*/
static getParser(packageName, paths, language) {
let parser;
// Check the first path to get the type of parsers needed
if (!language) {
if (paths != null && paths.length > 0) {
language = path.extname(paths[0]);
}
}
switch (language) {
case ".ts":
parser = new typescript_parser_1.TypescriptParser(packageName, paths);
break;
case ".po":
case ".pot":
parser = new portableObject_parser_1.PortableObjectParser(packageName, paths);
break;
default:
throw new Error("Not Implemented Yet");
}
return parser;
}
}
exports.ParserFactory = ParserFactory;
//# sourceMappingURL=index.js.map