From 4bd30b51a40894c0ae21941467e02ad38d5c80dd Mon Sep 17 00:00:00 2001 From: Benjamin LONGEARET Date: Wed, 2 Mar 2016 10:29:01 +0100 Subject: [PATCH 1/5] refactor(adapter): Move to ES6 --- src/adapter/adapter.js | 20 ++++++++ src/adapter/json-adapter.js | 93 +++++++++++++++++-------------------- src/adapter/pot-adapter.js | 14 ++---- src/index.js | 6 +-- tests/index.spec.js | 2 - 5 files changed, 68 insertions(+), 67 deletions(-) create mode 100644 src/adapter/adapter.js diff --git a/src/adapter/adapter.js b/src/adapter/adapter.js new file mode 100644 index 0000000..65ed7f2 --- /dev/null +++ b/src/adapter/adapter.js @@ -0,0 +1,20 @@ +import _ from 'lodash' + +export default class Adapter { + constructor(log, basePath) { + this.log = log + this.basePath = basePath + } + + init(params) { + this.params = _.defaults(params, this.params) + + try { + this.log.debug('Init PodAdapter', this.params.dest, this.params.prefix, this.params.suffix) + } catch(e) {} + } + + persist() { + throw new Error('Must be implemented') + } +} \ No newline at end of file diff --git a/src/adapter/json-adapter.js b/src/adapter/json-adapter.js index 982b2ad..c65b149 100644 --- a/src/adapter/json-adapter.js +++ b/src/adapter/json-adapter.js @@ -7,50 +7,42 @@ * */ -(function() { - 'use strict' - - var path = require('path') - var fs = require('fs') - var Utils = require('./../utils.js') - var Translations = require('./../translations.js') - - var _log, _basePath, _utils - - - function JsonAdapter(log, basePath) { - _log = log - _basePath = basePath - _utils = new Utils.Utils({ - basePath: _basePath +import path from 'path' +import fs from 'fs' +import Adapter from './adapter' +import {Utils} from './../utils' +import {Translations} from './../translations' + +export class JsonAdapter extends Adapter { + + constructor(log, basePath) { + super(log, basePath) + this.utils = new Utils({ + "basePath": basePath }) + + this.params = { + lang: [], + prefix: '', + prefix: '', + suffix: '.json', + source: '', + defaultLang: '.', + stringifyOptions: null + } } - JsonAdapter.prototype.init = function(params) { - this.dest = params.dest - this.lang = params.lang - this.prefix = params.prefix - this.suffix = params.suffix || '.json' - this.source = params.source - this.defaultLang = params.defaultLang - this.stringifyOptions = params.stringifyOptions + getDestFilename(language) { + return path.resolve(this.basePath, path.join(this.params.dest, this.params.prefix + language + this.params.suffix)) } - JsonAdapter.prototype.persist = function(_translation) { - var lang = this.lang - var dest = this.dest - var prefix = this.prefix - var suffix = this.suffix - var source = this.source || '' - var defaultLang = this.defaultLang || '.' - var stringify_options = this.stringifyOptions || null - - // Build all output language files - lang.forEach(function (lang) { - - var destFilename = path.resolve(_basePath, path.join(dest, prefix + lang + suffix)), - filename = source, - translations = {}, + persist(translations) { + // Build all output language files + this.params.lang.forEach((language) => { + + + let destFilename = this.getDestFilename(language), + filename = this.params.source, json = {} // Test source filename @@ -58,22 +50,22 @@ filename = destFilename } - _log.info('Process ' + lang + ' : ' + filename) + this.log.debug('Process ' + language + ' : ' + filename) - var isDefaultLang = (defaultLang === lang) + var isDefaultLang = (this.params.defaultLang === language) try { // Test if filename exists fs.statSync(filename) - _log.debug('File Exists. ' + destFilename) + this.log.debug('File Exists. ' + destFilename) json = JSON.parse(fs.readFileSync(filename, {encoding: 'utf8'})) } catch (e) { - _log.debug('Create file: ' + destFilename + (isDefaultLang ? ' (' + lang + ' is the default language)' : '')) + this.log.debug('Create file: ' + destFilename + (isDefaultLang ? ' (' + language + ' is the default language)' : '')) } - translations = _translation.getMergedTranslations(Translations.Translations.flatten(json), isDefaultLang) + let _translations = translations.getMergedTranslations(Translations.flatten(json), isDefaultLang) - var stats = _translation.getStats() - var statEmptyType = _translation.params.nullEmpty ? "null" : "empty" + var stats = translations.getStats() + var statEmptyType = translations.params.nullEmpty ? "null" : "empty" var statPercentage = Math.round(stats[statEmptyType] / stats["total"] * 100) statPercentage = isNaN(statPercentage) ? 100 : statPercentage var statsString = "Statistics : " + @@ -82,13 +74,12 @@ " / Deleted: " + stats["deleted"] + " / New: " + stats["new"] - _log.info(statsString) + this.log.debug(statsString) - // Write JSON file for lang - fs.writeFileSync(path.resolve(_basePath, destFilename), _utils.customStringify(translations, stringify_options) + '\n') + // Write JSON file for language + fs.writeFileSync(path.resolve(this.basePath, destFilename), this.utils.customStringify(_translations, this.stringifyOptions) + '\n') }) } - module.exports = JsonAdapter -}()) +} diff --git a/src/adapter/pot-adapter.js b/src/adapter/pot-adapter.js index 3af7c0a..a0b1456 100644 --- a/src/adapter/pot-adapter.js +++ b/src/adapter/pot-adapter.js @@ -2,6 +2,7 @@ import fs from 'fs' import path from 'path' import Po from 'pofile' import _ from 'lodash' +import Adapter from './adapter' export class PotObject { @@ -20,11 +21,10 @@ msgstr "${PotObject.escapeString(this.msg)}"` PotObject.escapeString = (str) => (""+str).replace(/"/g, '\\"') -export class PotAdapter { +export class PotAdapter extends Adapter { constructor(log, basePath) { - this.log = log - this.basePath = basePath + super(log, basePath) this.params = { dest: '.', @@ -33,14 +33,6 @@ export class PotAdapter { } } - init(params) { - this.params = _.defaults(params, this.params) - - try { - this.log.debug('Init PodAdapter', this.params.dest, this.params.prefix, this.params.suffix) - } catch(e) {} - } - persist(translations) { var catalog = new Po() diff --git a/src/index.js b/src/index.js index 8af3f8e..ac4018c 100644 --- a/src/index.js +++ b/src/index.js @@ -14,6 +14,8 @@ import Log from 'log' import pkg from '../package.json' import {Utils} from './utils.js' import {Translations} from './translations.js' +import {PotAdapter} from './adapter/pot-adapter.js' +import {JsonAdapter} from './adapter/json-adapter.js' var extractor @@ -334,13 +336,11 @@ var extractor switch(adapter) { case 'pot': - var PotAdapter = require('./adapter/pot-adapter.js') - var toPot = new PotAdapter.PotAdapter(_log, _basePath) + var toPot = new PotAdapter(_log, _basePath) toPot.init(params) _translation.persist(toPot) break default: - var JsonAdapter = require('./adapter/json-adapter.js') var toJson = new JsonAdapter(_log, _basePath) toJson.init(params) _translation.persist(toJson) diff --git a/tests/index.spec.js b/tests/index.spec.js index 247a012..0dafa30 100644 --- a/tests/index.spec.js +++ b/tests/index.spec.js @@ -8,8 +8,6 @@ import preset from './preset.conf.js' import pkg from '../package.json' describe('Extractor', () => { - let extractor - describe('Interface', () => { it('should expose the current version', () => { expect(AngularTranslateExtractor.VERSION).to.be.a('string') From 544d39d07d6053476fb22e1e4691cc95acdc0806 Mon Sep 17 00:00:00 2001 From: Benjamin LONGEARET Date: Wed, 2 Mar 2016 10:30:42 +0100 Subject: [PATCH 2/5] chore(output): Use json-stable-stringify to format output --- src/utils.js | 18 ++++-------- tests/existing/11_en_US.json | 2 +- tests/expected/00_fr_FR.json | 46 +++++++++++++++---------------- tests/expected/01_fr_FR.json | 46 +++++++++++++++---------------- tests/expected/02_fr_FR.json | 46 +++++++++++++++---------------- tests/expected/03_fr_FR.json | 44 +++++++++++++++--------------- tests/expected/04_en_US.json | 46 +++++++++++++++---------------- tests/expected/04_fr_FR.json | 46 +++++++++++++++---------------- tests/expected/05_en_US.json | 50 +++++++++++++++++----------------- tests/expected/06_fr_FR.json | 8 +++--- tests/expected/07_en_US.json | 8 +++--- tests/expected/07_fr_FR.json | 8 +++--- tests/expected/08_fr_FR.json | 8 +++--- tests/expected/09_A_fr_FR.json | 30 ++++++++++---------- tests/expected/09_B_fr_FR.json | 50 +++++++++++++++++----------------- tests/expected/10_1_fr_FR.json | 46 +++++++++++++++---------------- tests/expected/10_fr_FR.json | 46 +++++++++++++++---------------- tests/expected/11_en_US.json | 2 +- tests/expected/12_en_US.json | 4 +-- tests/expected/13_fr_FR.json | 14 +++++----- tests/utils.spec.js | 23 +++++----------- 21 files changed, 288 insertions(+), 303 deletions(-) diff --git a/src/utils.js b/src/utils.js index 7edd22c..0539fca 100644 --- a/src/utils.js +++ b/src/utils.js @@ -18,18 +18,12 @@ export class Utils { * @returns {*} */ customStringify(value, options) { - if (options) { - return stringify(value, _.isObject(options) ? options : { - space: ' ', - cmp: function (a, b) { - var lower = function (a) { - return a.toLowerCase() - } - return lower(a.key) < lower(b.key) ? -1 : 1 - } - }) - } - return JSON.stringify(value, null, 4) + return stringify(value, _.isObject(options) ? options : { + space: ' ', + cmp: function (a, b) { + return a.key < b.key ? -1 : 1 + } + }) } /** diff --git a/tests/existing/11_en_US.json b/tests/existing/11_en_US.json index 5564363..56f28f7 100644 --- a/tests/existing/11_en_US.json +++ b/tests/existing/11_en_US.json @@ -1,8 +1,8 @@ { "COMMON": { - "A_VIRTUAL_LINK": "@:COMMON.A_VIRTUAL_TRANSLATION", "A_TRANSLATION": "Just a translation", "A_TRUE_LINK": "@:COMMON.A_TRANSLATION", + "A_VIRTUAL_LINK": "@:COMMON.A_VIRTUAL_TRANSLATION", "A_VIRTUAL_TRANSLATION": "A virtual translation" } } diff --git a/tests/expected/00_fr_FR.json b/tests/expected/00_fr_FR.json index 7c49fa1..fc3b108 100644 --- a/tests/expected/00_fr_FR.json +++ b/tests/expected/00_fr_FR.json @@ -1,42 +1,42 @@ { - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": "", "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", + "HtmlFilterDoubleQuote{} on same line 2/2": "", + "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", + "HtmlFilterSimpleQuoteOneTimeBinding": "", "HtmlNgBindHtml Key ' 1/1": "", + "JavascriptFilter 1/2 with var \"{name}\"": "", + "JavascriptFilter 2/2 without var": "", + "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", + "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", + "JavascriptServiceArraySimpleQuote 1/2 without var.": "", + "JavascriptServiceArraySimpleQuote 2/2 without var.": "", + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", "NONAMESPACE": "", "SUB.NAMESPACE.VAL 1": "", "SUB.NAMESPACE.VAL 2": "", "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", "SUB.NS.VAL 1.test 2": "", + "SUB.NS.VAL 1.test1": "", + "SUB.NS.VAL 2": "", "SUB.NS.vAL 0": "", - "all.toto.titi": "", "all.tato.tIiti": "", + "all.tato.tZti": "", "all.tato.tati": "", "all.tato.tbti": "", - "all.tato.tZti": "", "all.tato.tdti": "", "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", + "all.toto.titi": "", "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" + "mySingleQ'uotedCommentTranslation '": "" } diff --git a/tests/expected/01_fr_FR.json b/tests/expected/01_fr_FR.json index 2c50e7c..76a0f14 100644 --- a/tests/expected/01_fr_FR.json +++ b/tests/expected/01_fr_FR.json @@ -1,42 +1,42 @@ { - "HtmlFilterSimpleQuoteOneTimeBinding": null, - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": null, - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": null, - "HtmlFilterDoubleQuote{} on same line 2/2": null, - "HtmlDirectiveKeyFromText": null, "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "My directive translation", "HtmlDirective 2/2": null, - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": null, "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": null, - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": null, + "HtmlFilterDoubleQuote{} on same line 2/2": null, + "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": null, + "HtmlFilterSimpleQuoteOneTimeBinding": null, "HtmlNgBindHtml Key ' 1/1": null, + "JavascriptFilter 1/2 with var \"{name}\"": "my {name} javascript filter", + "JavascriptFilter 2/2 without var": null, + "JavascriptServiceArrayDoubleQuote 1/2 without var.": null, + "JavascriptServiceArrayDoubleQuote 2/2 without var.": null, + "JavascriptServiceArraySimpleQuote 1/2 without var.": null, + "JavascriptServiceArraySimpleQuote 2/2 without var.": null, + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": null, + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": null, + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": null, + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": null, "NONAMESPACE": null, "SUB.NAMESPACE.VAL 1": null, "SUB.NAMESPACE.VAL 2": null, "SUB.NS.VAL 1": null, - "SUB.NS.VAL 2": null, - "SUB.NS.VAL 1.test1": null, "SUB.NS.VAL 1.test 2": null, + "SUB.NS.VAL 1.test1": null, + "SUB.NS.VAL 2": null, "SUB.NS.vAL 0": null, - "all.toto.titi": null, "all.tato.tIiti": null, + "all.tato.tZti": null, "all.tato.tati": null, "all.tato.tbti": null, - "all.tato.tZti": null, "all.tato.tdti": null, "all.tato.tzti": null, - "mySingleQ'uotedCommentTranslation '": null, + "all.toto.titi": null, "myDoubleQuotedCommentTranslation \"e\"s\"": null, - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": null, - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": null, - "JavascriptServiceArraySimpleQuote 1/2 without var.": null, - "JavascriptServiceArraySimpleQuote 2/2 without var.": null, - "JavascriptServiceArrayDoubleQuote 1/2 without var.": null, - "JavascriptServiceArrayDoubleQuote 2/2 without var.": null, - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": null, - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": null, - "JavascriptFilter 1/2 with var \"{name}\"": "my {name} javascript filter", - "JavascriptFilter 2/2 without var": null + "mySingleQ'uotedCommentTranslation '": null } diff --git a/tests/expected/02_fr_FR.json b/tests/expected/02_fr_FR.json index 81bf7ce..666ec47 100644 --- a/tests/expected/02_fr_FR.json +++ b/tests/expected/02_fr_FR.json @@ -1,42 +1,42 @@ { - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "My directive translation", "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": "", "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", + "HtmlFilterDoubleQuote{} on same line 2/2": "", + "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", + "HtmlFilterSimpleQuoteOneTimeBinding": "", "HtmlNgBindHtml Key ' 1/1": "", + "JavascriptFilter 1/2 with var \"{name}\"": "my {name} javascript filter", + "JavascriptFilter 2/2 without var": "", + "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", + "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", + "JavascriptServiceArraySimpleQuote 1/2 without var.": "", + "JavascriptServiceArraySimpleQuote 2/2 without var.": "", + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", "NONAMESPACE": "", "SUB.NAMESPACE.VAL 1": "", "SUB.NAMESPACE.VAL 2": "", "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", "SUB.NS.VAL 1.test 2": "", + "SUB.NS.VAL 1.test1": "", + "SUB.NS.VAL 2": "", "SUB.NS.vAL 0": "", - "all.toto.titi": "", "all.tato.tIiti": "", + "all.tato.tZti": "", "all.tato.tati": "", "all.tato.tbti": "", - "all.tato.tZti": "", "all.tato.tdti": "", "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", + "all.toto.titi": "", "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "my {name} javascript filter", - "JavascriptFilter 2/2 without var": "" + "mySingleQ'uotedCommentTranslation '": "" } diff --git a/tests/expected/03_fr_FR.json b/tests/expected/03_fr_FR.json index e5a791b..67dc3eb 100644 --- a/tests/expected/03_fr_FR.json +++ b/tests/expected/03_fr_FR.json @@ -1,41 +1,41 @@ { - "HtmlFilterSimpleQuote[] interp'olation [[xx]]": "", - "HtmlFilterSimpleQuote[] on same line 1/2": "", - "HtmlFilterSimpleQuote[] on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": "", "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterSimpleQuote[] interp'olation [[xx]]": "", + "HtmlFilterSimpleQuote[] on same line 1/2": "", + "HtmlFilterSimpleQuote[] on same line 2/2": "", "HtmlNgBindHtml Key ' 1/1": "", + "JavascriptFilter 1/2 with var \"{name}\"": "", + "JavascriptFilter 2/2 without var": "", + "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", + "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", + "JavascriptServiceArraySimpleQuote 1/2 without var.": "", + "JavascriptServiceArraySimpleQuote 2/2 without var.": "", + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", "NONAMESPACE": "", "SUB.NAMESPACE.VAL 1": "", "SUB.NAMESPACE.VAL 2": "", "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", "SUB.NS.VAL 1.test 2": "", + "SUB.NS.VAL 1.test1": "", + "SUB.NS.VAL 2": "", "SUB.NS.vAL 0": "", - "all.toto.titi": "", "all.tato.tIiti": "", + "all.tato.tZti": "", "all.tato.tati": "", "all.tato.tbti": "", - "all.tato.tZti": "", "all.tato.tdti": "", "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", + "all.toto.titi": "", "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" + "mySingleQ'uotedCommentTranslation '": "" } diff --git a/tests/expected/04_en_US.json b/tests/expected/04_en_US.json index 2fa9b9d..5c0866b 100644 --- a/tests/expected/04_en_US.json +++ b/tests/expected/04_en_US.json @@ -1,42 +1,42 @@ { - "HtmlFilterSimpleQuoteOneTimeBinding": "HtmlFilterSimpleQuoteOneTimeBinding", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "HtmlFilterDoubleQuote{} interp\"olation {{xx}}", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "HtmlFilterDoubleQuote{} {{var}}on same line 1/2", - "HtmlFilterDoubleQuote{} on same line 2/2": "HtmlFilterDoubleQuote{} on same line 2/2", - "HtmlDirectiveKeyFromText": "HtmlDirectiveKeyFromText", "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô", "HtmlDirective 2/2": "HtmlDirective 2/2", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": "HtmlDirectiveKeyFromText", "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": "HtmlDirectiveStandalone", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "HtmlFilterDoubleQuote{} interp\"olation {{xx}}", + "HtmlFilterDoubleQuote{} on same line 2/2": "HtmlFilterDoubleQuote{} on same line 2/2", + "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "HtmlFilterDoubleQuote{} {{var}}on same line 1/2", + "HtmlFilterSimpleQuoteOneTimeBinding": "HtmlFilterSimpleQuoteOneTimeBinding", "HtmlNgBindHtml Key ' 1/1": "HtmlNgBindHtml Key ' 1/1", + "JavascriptFilter 1/2 with var \"{name}\"": "JavascriptFilter 1/2 with var \"{name}\"", + "JavascriptFilter 2/2 without var": "JavascriptFilter 2/2 without var", + "JavascriptServiceArrayDoubleQuote 1/2 without var.": "JavascriptServiceArrayDoubleQuote 1/2 without var.", + "JavascriptServiceArrayDoubleQuote 2/2 without var.": "JavascriptServiceArrayDoubleQuote 2/2 without var.", + "JavascriptServiceArraySimpleQuote 1/2 without var.": "JavascriptServiceArraySimpleQuote 1/2 without var.", + "JavascriptServiceArraySimpleQuote 2/2 without var.": "JavascriptServiceArraySimpleQuote 2/2 without var.", + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".", + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".", + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".", + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".", "NONAMESPACE": "NONAMESPACE", "SUB.NAMESPACE.VAL 1": "SUB.NAMESPACE.VAL 1", "SUB.NAMESPACE.VAL 2": "SUB.NAMESPACE.VAL 2", "SUB.NS.VAL 1": "SUB.NS.VAL 1", - "SUB.NS.VAL 2": "SUB.NS.VAL 2", - "SUB.NS.VAL 1.test1": "SUB.NS.VAL 1.test1", "SUB.NS.VAL 1.test 2": "SUB.NS.VAL 1.test 2", + "SUB.NS.VAL 1.test1": "SUB.NS.VAL 1.test1", + "SUB.NS.VAL 2": "SUB.NS.VAL 2", "SUB.NS.vAL 0": "SUB.NS.vAL 0", - "all.toto.titi": "all.toto.titi", "all.tato.tIiti": "all.tato.tIiti", + "all.tato.tZti": "all.tato.tZti", "all.tato.tati": "all.tato.tati", "all.tato.tbti": "all.tato.tbti", - "all.tato.tZti": "all.tato.tZti", "all.tato.tdti": "all.tato.tdti", "all.tato.tzti": "all.tato.tzti", - "mySingleQ'uotedCommentTranslation '": "mySingleQ'uotedCommentTranslation '", + "all.toto.titi": "all.toto.titi", "myDoubleQuotedCommentTranslation \"e\"s\"": "myDoubleQuotedCommentTranslation \"e\"s\"", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "JavascriptServiceArraySimpleQuote 1/2 without var.", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "JavascriptServiceArraySimpleQuote 2/2 without var.", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "JavascriptServiceArrayDoubleQuote 1/2 without var.", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "JavascriptServiceArrayDoubleQuote 2/2 without var.", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".", - "JavascriptFilter 1/2 with var \"{name}\"": "JavascriptFilter 1/2 with var \"{name}\"", - "JavascriptFilter 2/2 without var": "JavascriptFilter 2/2 without var" + "mySingleQ'uotedCommentTranslation '": "mySingleQ'uotedCommentTranslation '" } diff --git a/tests/expected/04_fr_FR.json b/tests/expected/04_fr_FR.json index 7c49fa1..fc3b108 100644 --- a/tests/expected/04_fr_FR.json +++ b/tests/expected/04_fr_FR.json @@ -1,42 +1,42 @@ { - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": "", "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", + "HtmlFilterDoubleQuote{} on same line 2/2": "", + "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", + "HtmlFilterSimpleQuoteOneTimeBinding": "", "HtmlNgBindHtml Key ' 1/1": "", + "JavascriptFilter 1/2 with var \"{name}\"": "", + "JavascriptFilter 2/2 without var": "", + "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", + "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", + "JavascriptServiceArraySimpleQuote 1/2 without var.": "", + "JavascriptServiceArraySimpleQuote 2/2 without var.": "", + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", "NONAMESPACE": "", "SUB.NAMESPACE.VAL 1": "", "SUB.NAMESPACE.VAL 2": "", "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", "SUB.NS.VAL 1.test 2": "", + "SUB.NS.VAL 1.test1": "", + "SUB.NS.VAL 2": "", "SUB.NS.vAL 0": "", - "all.toto.titi": "", "all.tato.tIiti": "", + "all.tato.tZti": "", "all.tato.tati": "", "all.tato.tbti": "", - "all.tato.tZti": "", "all.tato.tdti": "", "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", + "all.toto.titi": "", "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" + "mySingleQ'uotedCommentTranslation '": "" } diff --git a/tests/expected/05_en_US.json b/tests/expected/05_en_US.json index 582e960..c69e969 100644 --- a/tests/expected/05_en_US.json +++ b/tests/expected/05_en_US.json @@ -1,46 +1,46 @@ { - "HtmlFilterSimpleQuoteOneTimeBinding": "HtmlFilterSimpleQuoteOneTimeBinding", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "HtmlFilterDoubleQuote{} interp\"olation {{xx}}", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "HtmlFilterDoubleQuote{} {{var}}on same line 1/2", - "HtmlFilterDoubleQuote{} on same line 2/2": "HtmlFilterDoubleQuote{} on same line 2/2", - "HtmlDirectiveKeyFromText": "HtmlDirectiveKeyFromText", "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô", "HtmlDirective 2/2": "HtmlDirective 2/2", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": "HtmlDirectiveKeyFromText", "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": "HtmlDirectiveStandalone", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "HtmlFilterDoubleQuote{} interp\"olation {{xx}}", + "HtmlFilterDoubleQuote{} on same line 2/2": "HtmlFilterDoubleQuote{} on same line 2/2", + "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "HtmlFilterDoubleQuote{} {{var}}on same line 1/2", + "HtmlFilterSimpleQuoteOneTimeBinding": "HtmlFilterSimpleQuoteOneTimeBinding", "HtmlNgBindHtml Key ' 1/1": "HtmlNgBindHtml Key ' 1/1", + "JavascriptFilter 1/2 with var \"{name}\"": "JavascriptFilter 1/2 with var \"{name}\"", + "JavascriptFilter 2/2 without var": "JavascriptFilter 2/2 without var", + "JavascriptServiceArrayDoubleQuote 1/2 without var.": "JavascriptServiceArrayDoubleQuote 1/2 without var.", + "JavascriptServiceArrayDoubleQuote 2/2 without var.": "JavascriptServiceArrayDoubleQuote 2/2 without var.", + "JavascriptServiceArraySimpleQuote 1/2 without var.": "JavascriptServiceArraySimpleQuote 1/2 without var.", + "JavascriptServiceArraySimpleQuote 2/2 without var.": "JavascriptServiceArraySimpleQuote 2/2 without var.", + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".", + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".", + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".", + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".", "NONAMESPACE": "NONAMESPACE", "SUB.NAMESPACE.VAL 1": "SUB.NAMESPACE.VAL 1", "SUB.NAMESPACE.VAL 2": "SUB.NAMESPACE.VAL 2", "SUB.NS.VAL 1": "SUB.NS.VAL 1", - "SUB.NS.VAL 2": "SUB.NS.VAL 2", - "SUB.NS.VAL 1.test1": "SUB.NS.VAL 1.test1", "SUB.NS.VAL 1.test 2": "SUB.NS.VAL 1.test 2", + "SUB.NS.VAL 1.test1": "SUB.NS.VAL 1.test1", + "SUB.NS.VAL 2": "SUB.NS.VAL 2", "SUB.NS.vAL 0": "SUB.NS.vAL 0", - "all.toto.titi": "all.toto.titi", "all.tato.tIiti": "all.tato.tIiti", + "all.tato.tZti": "all.tato.tZti", "all.tato.tati": "all.tato.tati", "all.tato.tbti": "all.tato.tbti", - "all.tato.tZti": "all.tato.tZti", "all.tato.tdti": "all.tato.tdti", "all.tato.tzti": "all.tato.tzti", - "mySingleQ'uotedCommentTranslation '": "mySingleQ'uotedCommentTranslation '", - "myDoubleQuotedCommentTranslation \"e\"s\"": "myDoubleQuotedCommentTranslation \"e\"s\"", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "JavascriptServiceArraySimpleQuote 1/2 without var.", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "JavascriptServiceArraySimpleQuote 2/2 without var.", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "JavascriptServiceArrayDoubleQuote 1/2 without var.", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "JavascriptServiceArrayDoubleQuote 2/2 without var.", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".", - "JavascriptFilter 1/2 with var \"{name}\"": "JavascriptFilter 1/2 with var \"{name}\"", - "JavascriptFilter 2/2 without var": "JavascriptFilter 2/2 without var", + "all.toto.titi": "all.toto.titi", "config:translation 00": "config:translation 00", "config:translation 01": "config:translation 01", "config:translation 02": "config:translation 02", - "config:translation 03": "config:translation 03" + "config:translation 03": "config:translation 03", + "myDoubleQuotedCommentTranslation \"e\"s\"": "myDoubleQuotedCommentTranslation \"e\"s\"", + "mySingleQ'uotedCommentTranslation '": "mySingleQ'uotedCommentTranslation '" } diff --git a/tests/expected/06_fr_FR.json b/tests/expected/06_fr_FR.json index bfde53b..2419aee 100644 --- a/tests/expected/06_fr_FR.json +++ b/tests/expected/06_fr_FR.json @@ -6,11 +6,11 @@ "VAL 2": "" }, "NS": { - "VAL 2": "", "VAL 1": { - "test1": "", - "test 2": "" - } + "test 2": "", + "test1": "" + }, + "VAL 2": "" } } } diff --git a/tests/expected/07_en_US.json b/tests/expected/07_en_US.json index d15b34f..1eb05d0 100644 --- a/tests/expected/07_en_US.json +++ b/tests/expected/07_en_US.json @@ -6,11 +6,11 @@ "VAL 2": null }, "NS": { - "VAL 2": null, "VAL 1": { - "test1": null, - "test 2": null - } + "test 2": null, + "test1": null + }, + "VAL 2": null } } } diff --git a/tests/expected/07_fr_FR.json b/tests/expected/07_fr_FR.json index 3fa852b..b620809 100644 --- a/tests/expected/07_fr_FR.json +++ b/tests/expected/07_fr_FR.json @@ -6,11 +6,11 @@ "VAL 2": "SUB.NAMESPACE.VAL 2" }, "NS": { - "VAL 2": "SUB.NS.VAL 2", "VAL 1": { - "test1": "SUB.NS.VAL 1.test1", - "test 2": "SUB.NS.VAL 1.test 2" - } + "test 2": "SUB.NS.VAL 1.test 2", + "test1": "SUB.NS.VAL 1.test1" + }, + "VAL 2": "SUB.NS.VAL 2" } } } diff --git a/tests/expected/08_fr_FR.json b/tests/expected/08_fr_FR.json index 7fd3bd7..71a310e 100644 --- a/tests/expected/08_fr_FR.json +++ b/tests/expected/08_fr_FR.json @@ -6,11 +6,11 @@ "VAL 2": "Waouhh!" }, "NS": { - "VAL 2": "SUB.NS.VAL 2", "VAL 1": { - "test1": "SUB.NS.VAL 1.test1", - "test 2": "SUB.NS.VAL 1.test 2" - } + "test 2": "SUB.NS.VAL 1.test 2", + "test1": "SUB.NS.VAL 1.test1" + }, + "VAL 2": "SUB.NS.VAL 2" } } } diff --git a/tests/expected/09_A_fr_FR.json b/tests/expected/09_A_fr_FR.json index 21aa3de..761b722 100644 --- a/tests/expected/09_A_fr_FR.json +++ b/tests/expected/09_A_fr_FR.json @@ -1,29 +1,29 @@ { - "all": { - "tato": { - "tati": "all.tato.tati", - "tbti": "all.tato.tbti", - "tdti": "all.tato.tdti", - "tIiti": "all.tato.tIiti", - "tzti": "all.tato.tzti", - "tZti": "all.tato.tZti" - }, - "toto": { - "titi": "all.toto.titi" - } - }, "SUB": { "NAMESPACE": { "VAL 1": "My default SUB.NAMESPACE.VAL 1", "VAL 2": "Waouhh!" }, "NS": { - "vAL 0": "SUB.NS.vAL 0", "VAL 1": { "test 2": "SUB.NS.VAL 1.test 2", "test1": "SUB.NS.VAL 1.test1" }, - "VAL 2": "SUB.NS.VAL 2" + "VAL 2": "SUB.NS.VAL 2", + "vAL 0": "SUB.NS.vAL 0" + } + }, + "all": { + "tato": { + "tIiti": "all.tato.tIiti", + "tZti": "all.tato.tZti", + "tati": "all.tato.tati", + "tbti": "all.tato.tbti", + "tdti": "all.tato.tdti", + "tzti": "all.tato.tzti" + }, + "toto": { + "titi": "all.toto.titi" } } } diff --git a/tests/expected/09_B_fr_FR.json b/tests/expected/09_B_fr_FR.json index a0a2fd8..761b722 100644 --- a/tests/expected/09_B_fr_FR.json +++ b/tests/expected/09_B_fr_FR.json @@ -1,29 +1,29 @@ { - "SUB": { - "NAMESPACE": { - "VAL 1": "My default SUB.NAMESPACE.VAL 1", - "VAL 2": "Waouhh!" + "SUB": { + "NAMESPACE": { + "VAL 1": "My default SUB.NAMESPACE.VAL 1", + "VAL 2": "Waouhh!" + }, + "NS": { + "VAL 1": { + "test 2": "SUB.NS.VAL 1.test 2", + "test1": "SUB.NS.VAL 1.test1" + }, + "VAL 2": "SUB.NS.VAL 2", + "vAL 0": "SUB.NS.vAL 0" + } }, - "NS": { - "VAL 1": { - "test 2": "SUB.NS.VAL 1.test 2", - "test1": "SUB.NS.VAL 1.test1" - }, - "VAL 2": "SUB.NS.VAL 2", - "vAL 0": "SUB.NS.vAL 0" + "all": { + "tato": { + "tIiti": "all.tato.tIiti", + "tZti": "all.tato.tZti", + "tati": "all.tato.tati", + "tbti": "all.tato.tbti", + "tdti": "all.tato.tdti", + "tzti": "all.tato.tzti" + }, + "toto": { + "titi": "all.toto.titi" + } } - }, - "all": { - "tato": { - "tIiti": "all.tato.tIiti", - "tZti": "all.tato.tZti", - "tati": "all.tato.tati", - "tbti": "all.tato.tbti", - "tdti": "all.tato.tdti", - "tzti": "all.tato.tzti" - }, - "toto": { - "titi": "all.toto.titi" - } - } } diff --git a/tests/expected/10_1_fr_FR.json b/tests/expected/10_1_fr_FR.json index 8500907..a303ec6 100644 --- a/tests/expected/10_1_fr_FR.json +++ b/tests/expected/10_1_fr_FR.json @@ -1,44 +1,44 @@ { - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": "", "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", + "HtmlFilterDoubleQuote{} on same line 2/2": "", + "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", + "HtmlFilterSimpleQuoteOneTimeBinding": "", "HtmlNgBindHtml Key ' 1/1": "", + "JavascriptFilter 1/2 with var \"{name}\"": "", + "JavascriptFilter 2/2 without var": "", + "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", + "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", + "JavascriptServiceArraySimpleQuote 1/2 without var.": "", + "JavascriptServiceArraySimpleQuote 2/2 without var.": "", + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", "MY_CUSTOM_EXTRA_TRANSLATION_01": "", "MY_CUSTOM_EXTRA_TRANSLATION_02": "", "NONAMESPACE": "", "SUB.NAMESPACE.VAL 1": "", "SUB.NAMESPACE.VAL 2": "", "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", "SUB.NS.VAL 1.test 2": "", + "SUB.NS.VAL 1.test1": "", + "SUB.NS.VAL 2": "", "SUB.NS.vAL 0": "", - "all.toto.titi": "", "all.tato.tIiti": "", + "all.tato.tZti": "", "all.tato.tati": "", "all.tato.tbti": "", - "all.tato.tZti": "", "all.tato.tdti": "", "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", + "all.toto.titi": "", "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" + "mySingleQ'uotedCommentTranslation '": "" } diff --git a/tests/expected/10_fr_FR.json b/tests/expected/10_fr_FR.json index 173d0fc..09d40a0 100644 --- a/tests/expected/10_fr_FR.json +++ b/tests/expected/10_fr_FR.json @@ -1,43 +1,43 @@ { - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlDirectiveKeyFromText": "", "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", + "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", + "HtmlDirectiveSimpleQuoteStandalone": "test 01", "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", + "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", + "HtmlFilterDoubleQuote{} on same line 2/2": "", + "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", + "HtmlFilterSimpleQuoteOneTimeBinding": "", "HtmlNgBindHtml Key ' 1/1": "", + "JavascriptFilter 1/2 with var \"{name}\"": "", + "JavascriptFilter 2/2 without var": "", + "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", + "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", + "JavascriptServiceArraySimpleQuote 1/2 without var.": "", + "JavascriptServiceArraySimpleQuote 2/2 without var.": "", + "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", + "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", + "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", "MY.CUSTOM.REGEX": "", "NONAMESPACE": "", "SUB.NAMESPACE.VAL 1": "", "SUB.NAMESPACE.VAL 2": "", "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", "SUB.NS.VAL 1.test 2": "", + "SUB.NS.VAL 1.test1": "", + "SUB.NS.VAL 2": "", "SUB.NS.vAL 0": "", - "all.toto.titi": "", "all.tato.tIiti": "", + "all.tato.tZti": "", "all.tato.tati": "", "all.tato.tbti": "", - "all.tato.tZti": "", "all.tato.tdti": "", "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", + "all.toto.titi": "", "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" + "mySingleQ'uotedCommentTranslation '": "" } diff --git a/tests/expected/11_en_US.json b/tests/expected/11_en_US.json index 5564363..56f28f7 100644 --- a/tests/expected/11_en_US.json +++ b/tests/expected/11_en_US.json @@ -1,8 +1,8 @@ { "COMMON": { - "A_VIRTUAL_LINK": "@:COMMON.A_VIRTUAL_TRANSLATION", "A_TRANSLATION": "Just a translation", "A_TRUE_LINK": "@:COMMON.A_TRANSLATION", + "A_VIRTUAL_LINK": "@:COMMON.A_VIRTUAL_TRANSLATION", "A_VIRTUAL_TRANSLATION": "A virtual translation" } } diff --git a/tests/expected/12_en_US.json b/tests/expected/12_en_US.json index 4b8beb0..977cd69 100644 --- a/tests/expected/12_en_US.json +++ b/tests/expected/12_en_US.json @@ -1,5 +1,5 @@ { - "This is text to translate": "This is text to translate", "But I want to have the text as a key": "But I want to have the text as a key", - "For example this paragraph will be a key and value for default language": "For example this paragraph will be a key and value for default language" + "For example this paragraph will be a key and value for default language": "For example this paragraph will be a key and value for default language", + "This is text to translate": "This is text to translate" } diff --git a/tests/expected/13_fr_FR.json b/tests/expected/13_fr_FR.json index aefa6f9..7fc379e 100644 --- a/tests/expected/13_fr_FR.json +++ b/tests/expected/13_fr_FR.json @@ -1,14 +1,14 @@ { - "Update 03": "", "New \\\"user 03": "", - "Update \\' 06": "", - "New user 06": "", - "Update 02": "", "New user 02": "", + "New user 04": "", + "New user 05": "", + "New user 06": "", "TEST.Update.01": "", "TEST.Update.New user 01": "", - "Update 05": "", - "New user 05": "", + "Update 02": "", + "Update 03": "", "Update 04": "", - "New user 04": "" + "Update 05": "", + "Update \\' 06": "" } diff --git a/tests/utils.spec.js b/tests/utils.spec.js index e8d68cc..1f98b9d 100644 --- a/tests/utils.spec.js +++ b/tests/utils.spec.js @@ -37,24 +37,15 @@ describe('Utils', () => { }) describe('customStringify()', () => { - it('should return a default JSON.stringify(value, null, 4) if no options', () => { - var expected = JSON.stringify(JSONObject, null, 4) - expect(utils.customStringify(JSONObject)).equals(expected) - expect(utils.customStringify(JSONObject, null)).equals(expected) - expect(utils.customStringify(JSONObject, undefined)).equals(expected) - }) - it('should use default options if given options is not an object', () => { - let defaultOptions = { - space: ' ', - cmp: function (a, b) { - var lower = function (a) { - return a.toLowerCase() - } - return lower(a.key) < lower(b.key) ? -1 : 1 - } + let defaultOptions = { + space: ' ', + cmp: function (a, b) { + return a.key < b.key ? -1 : 1 } + } - var values = [true, 1, 'string'].forEach((value) => { + it('should use default options if given options is not an object or null', () => { + [true, 1, 'string'].forEach((value) => { expect(utils.customStringify(JSONObject, value)).equals(utils.customStringify(JSONObject, defaultOptions)) }) }) From 495e4d90ed22f788b0ae650a892766845f563042 Mon Sep 17 00:00:00 2001 From: Benjamin LONGEARET Date: Wed, 2 Mar 2016 10:31:29 +0100 Subject: [PATCH 3/5] refactor(test): Remove test old test folder --- test/angular-translate-extractor.conf.js | 226 ------------------ test/angular-translate-extractor_test.js | 201 ---------------- test/existing/11_en_US.json | 8 - test/expected/00_fr_FR.json | 42 ---- test/expected/01_fr_FR.json | 42 ---- test/expected/02_fr_FR.json | 42 ---- test/expected/03_fr_FR.json | 41 ---- test/expected/04_en_US.json | 42 ---- test/expected/04_fr_FR.json | 42 ---- test/expected/05_en_US.json | 46 ---- test/expected/06_fr_FR.json | 16 -- test/expected/07_en_US.json | 16 -- test/expected/07_fr_FR.json | 16 -- test/expected/08_fr_FR.json | 16 -- test/expected/09_A_fr_FR.json | 29 --- test/expected/09_B_fr_FR.json | 29 --- test/expected/10_1_fr_FR.json | 44 ---- test/expected/10_fr_FR.json | 43 ---- test/expected/11_en_US.json | 8 - test/expected/12_en_US.json | 5 - test/expected/13_fr_FR.json | 14 -- test/expected/template.pot | 165 ------------- test/fixtures/config.json | 16 -- test/fixtures/default_deleted_i18n.json | 6 - test/fixtures/default_exists_i18n.json | 5 - .../default_exists_i18n_namespace.json | 9 - test/fixtures/index.html | 91 ------- test/fixtures/index_key_as_text.html | 14 -- test/fixtures/index_namespace.html | 24 -- .../index_namespace_consistent_output.html | 30 --- test/fixtures/index_ternary_keys.html | 29 --- test/fixtures/links.js | 17 -- test/fixtures/titleService.js | 35 --- test/utils_test.js | 157 ------------ 34 files changed, 1566 deletions(-) delete mode 100644 test/angular-translate-extractor.conf.js delete mode 100644 test/angular-translate-extractor_test.js delete mode 100644 test/existing/11_en_US.json delete mode 100644 test/expected/00_fr_FR.json delete mode 100644 test/expected/01_fr_FR.json delete mode 100644 test/expected/02_fr_FR.json delete mode 100644 test/expected/03_fr_FR.json delete mode 100644 test/expected/04_en_US.json delete mode 100644 test/expected/04_fr_FR.json delete mode 100644 test/expected/05_en_US.json delete mode 100644 test/expected/06_fr_FR.json delete mode 100644 test/expected/07_en_US.json delete mode 100644 test/expected/07_fr_FR.json delete mode 100644 test/expected/08_fr_FR.json delete mode 100644 test/expected/09_A_fr_FR.json delete mode 100644 test/expected/09_B_fr_FR.json delete mode 100644 test/expected/10_1_fr_FR.json delete mode 100644 test/expected/10_fr_FR.json delete mode 100644 test/expected/11_en_US.json delete mode 100644 test/expected/12_en_US.json delete mode 100644 test/expected/13_fr_FR.json delete mode 100644 test/expected/template.pot delete mode 100644 test/fixtures/config.json delete mode 100644 test/fixtures/default_deleted_i18n.json delete mode 100644 test/fixtures/default_exists_i18n.json delete mode 100644 test/fixtures/default_exists_i18n_namespace.json delete mode 100644 test/fixtures/index.html delete mode 100644 test/fixtures/index_key_as_text.html delete mode 100644 test/fixtures/index_namespace.html delete mode 100644 test/fixtures/index_namespace_consistent_output.html delete mode 100644 test/fixtures/index_ternary_keys.html delete mode 100644 test/fixtures/links.js delete mode 100644 test/fixtures/titleService.js delete mode 100644 test/utils_test.js diff --git a/test/angular-translate-extractor.conf.js b/test/angular-translate-extractor.conf.js deleted file mode 100644 index 6d84575..0000000 --- a/test/angular-translate-extractor.conf.js +++ /dev/null @@ -1,226 +0,0 @@ -/** - * This file carry set of config for extractor and testing! - * - * Use path from the repository root path. - */ -module.exports = { - - // Provide fr_FR language - default_options: { - prefix: '00_', - suffix: '.json', - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - lang: ['fr_FR'], - dest: 'tmp' - }, - - default_exists_i18n : { - prefix: '01_', - suffix: '.json', - nullEmpty: true, - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - lang: ['fr_FR'], - dest: 'tmp', - source: 'test/fixtures/default_exists_i18n.json' // Use to generate different output file - }, - - default_deleted_i18n : { - prefix: '02_', - suffix: '.json', - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - lang: ['fr_FR'], - dest: 'tmp', - source: 'test/fixtures/default_deleted_i18n.json' // Use to generate different output file - }, - - interpolation_bracket: { - prefix: '03_', - suffix: '.json', - interpolation: { - startDelimiter: '[[', - endDelimiter: ']]' - }, - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - lang: ['fr_FR'], - dest: 'tmp' - }, - - default_language: { - prefix: '04_', - suffix: '.json', - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - lang: ['fr_FR', 'en_US'], - dest: 'tmp', - defaultLang: 'en_US' - }, - - json_extract: { - prefix: '05_', - suffix: '.json', - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - jsonSrc: [ 'test/fixtures/*.json' ], - jsonSrcName: ['label'], - lang: ['en_US'], - dest: 'tmp', - defaultLang: 'en_US' - }, - - sub_namespace: { - prefix: '06_', - suffix: '.json', - src: [ 'test/fixtures/index_namespace.html' ], - lang: ['fr_FR'], - namespace: true, - dest: 'tmp' - }, - - /** - * Test case: Feed - */ - sub_namespace_default_language: { - prefix: '07_', - suffix: '.json', - src: [ 'test/fixtures/index_namespace.html' ], - lang: ['fr_FR', 'en_US'], - defaultLang: 'fr_FR', - nullEmpty: true, - namespace: true, - dest: 'tmp' - }, - - /** - * Test case: Feed - */ - sub_namespace_default_language_source: { - prefix: '08_', - suffix: '.json', - src: [ 'test/fixtures/index_namespace.html' ], - lang: ['fr_FR'], - defaultLang: 'fr_FR', - safeMode: true, - nullEmpty: true, - namespace: true, - dest: 'tmp', - source: 'test/fixtures/default_exists_i18n_namespace.json' // Use to generate different output file - }, - - /** - * Test case: Use consistent output to be able to merge easily - */ - consistent_stringify: { - prefix: '09_A_', - suffix: '.json', - src: [ 'test/fixtures/index_namespace_consistent_output.html' ], - lang: ['fr_FR'], - defaultLang: 'fr_FR', - safeMode: true, - nullEmpty: true, - namespace: true, - stringifyOptions: true, - dest: 'tmp', - source: 'test/fixtures/default_exists_i18n_namespace.json' // Use to generate different output file - }, - - /** - * Test case: Use consistent output with options - */ - consistent_stringify_options: { - prefix: '09_B_', - suffix: '.json', - src: [ 'test/fixtures/index_namespace_consistent_output.html' ], - lang: ['fr_FR'], - defaultLang: 'fr_FR', - safeMode: true, - nullEmpty: true, - namespace: true, - stringifyOptions: { - space: ' ' - }, - dest: 'tmp', - source: 'test/fixtures/default_exists_i18n_namespace.json' // Use to generate different output file - }, - - /** - * Test case: Use consistent output with options - */ - extra_regexs: { - prefix: '10_', - suffix: '.json', - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - lang: ['fr_FR'], - customRegex: [ - 'tt-default="\'((?:\\\\.|[^\'\\\\])*)\'\\|translate"' - ], - dest: 'tmp' - }, - - /** - * Test case: Use consistent output with options - */ - extra_regexs_object: { - prefix: '10_1_', - suffix: '.json', - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - lang: ['fr_FR'], - customRegex: { - 'translate_function\\(\\s*\'((?:\\\\.|[^\'\\\\])*)\'[^\\)]*\\)': function (translationKey) { - return translationKey.replace(/\\\'/g, "'"); - }, - 'translate_function\\(\\s*"((?:\\\\.|[^"\\\\])*)"[^\\)]*\\)': function (translationKey) { - return translationKey.replace(/\\\"/g, '"'); - } - }, - dest: 'tmp' - }, - - /** - * Test case: Preserve translation links - */ - keep_translation_links: { - prefix: '11_', - suffix: '.json', - src: [ 'test/fixtures/links.js' ], - lang: ['en_US'], - dest: 'test/existing', - namespace: true - }, - - /** - * Test case: Allow text as keys - */ - key_as_text: { - prefix: '12_', - suffix: '.json', - src: ['test/fixtures/index_key_as_text.html'], - lang: ['en_US'], - dest: 'tmp', - keyAsText: true - }, - - /** - * Test case: Allow text as keys - */ - ternary_keys: { - prefix: '13_', - suffix: '.json', - src: ['test/fixtures/index_ternary_keys.html'], - lang: ['fr_FR'], - dest: 'tmp', - customRegex: { - 'translate_function\\(\\s*([^?]*?[^:]*:[^|}]*)[^\\)]*\\)': function (translationKey) { - return translationKey.replace(/\\\'/g, "'"); - } - } - }, - - /** - * Test case: POT adapter - */ - extract_to_pot: { - adapter: 'pot', - prefix: 'template', - src: [ 'test/fixtures/index.html', 'test/fixtures/index_key_as_text.html', 'test/fixtures/index_namespace.html', 'test/fixtures/index_namespace_consistent_output.html', 'test/fixtures/*.js', '!test/fixtures/links.js', '!test/fixtures/index_key_as_text.html' ], - lang: [ '' ], - dest: 'tmp' - } -}; \ No newline at end of file diff --git a/test/angular-translate-extractor_test.js b/test/angular-translate-extractor_test.js deleted file mode 100644 index df0ffbc..0000000 --- a/test/angular-translate-extractor_test.js +++ /dev/null @@ -1,201 +0,0 @@ -'use strict'; - -var grunt = require('grunt'); -var _ = require('lodash'); -var path = require('path'); -var extractor = require('../lib/index.js') - -var i18nextract_config = require('./angular-translate-extractor.conf'); - -exports.i18nextract = { - - setUp: function (callback) { - _.forEach(i18nextract_config, function(v, k) { - extractor.proceed(v, { - basePath: path.resolve('./') - }) - }) - callback(); - }, - - default_options: function(test) { - test.expect(1); - - var actual = grunt.file.read('tmp/00_fr_FR.json'); - grunt.log.writeflags(actual); - var expected = grunt.file.read('test/expected/00_fr_FR.json'); - grunt.log.writeflags(expected); - test.equal(actual, expected, '00 - default_options should be equal.'); - - test.done(); - }, - - default_exists_i18n: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/01_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/01_fr_FR.json' ); - test.equal( actual, expected, '01 - default_exists_i18n should be equal.' ); - - test.done(); - }, - - default_deleted_i18n: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/02_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/02_fr_FR.json' ); - test.equal(actual, expected, '02 - default_deleted_i18n should be equal.'); - - test.done(); - }, - - interpolation_bracket: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/03_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/03_fr_FR.json' ); - test.equal(actual, expected, '03 - interpolation_bracket should be equal.'); - - test.done(); - }, - - default_language: function(test) { - test.expect(2); - - var actual = grunt.file.read( 'tmp/04_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/04_fr_FR.json' ); - test.equal( actual, expected, '04 - default_language fr_FR should be equal.' ); - - var actual = grunt.file.read( 'tmp/04_en_US.json' ); - var expected = grunt.file.read( 'test/expected/04_en_US.json' ); - test.equal( actual, expected, '04 - default_language en_US should be equal.' ); - - test.done(); - }, - - json_extract: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/05_en_US.json' ); - var expected = grunt.file.read( 'test/expected/05_en_US.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - sub_namespace: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/06_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/06_fr_FR.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - sub_namespace_default_language: function(test) { - test.expect(2); - - var actual = grunt.file.read( 'tmp/07_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/07_fr_FR.json' ); - test.equal( actual, expected, 'Should equal.' ); - - var actual = grunt.file.read( 'tmp/07_en_US.json' ); - var expected = grunt.file.read( 'test/expected/07_en_US.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - sub_namespace_default_language_source: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/08_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/08_fr_FR.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - consistent_stringify: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/09_A_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/09_A_fr_FR.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - consistent_stringify_options: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/09_B_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/09_B_fr_FR.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - extra_regexs: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/10_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/10_fr_FR.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - extra_regexs_object: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/10_1_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/10_1_fr_FR.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - keep_translation_links: function(test) { - test.expect(1); - - var actual = grunt.file.readJSON( 'test/existing/11_en_US.json' ); - var expected = grunt.file.readJSON( 'test/expected/11_en_US.json' ); - test.deepEqual( actual, expected, 'Should equal.' ); - - test.done(); - }, - - key_as_text: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/12_en_US.json' ); - var expected = grunt.file.read( 'test/expected/12_en_US.json' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - }, - - ternary_keys: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/13_fr_FR.json' ); - var expected = grunt.file.read( 'test/expected/13_fr_FR.json' ); - test.equal( actual, expected, 'ternary_keys: 13_fr_FR.json should equal.' ); - - test.done(); - }, - - extract_to_pot: function(test) { - test.expect(1); - - var actual = grunt.file.read( 'tmp/template.pot' ); - var expected = grunt.file.read( 'test/expected/template.pot' ); - test.equal( actual, expected, 'Should equal.' ); - - test.done(); - } - -}; diff --git a/test/existing/11_en_US.json b/test/existing/11_en_US.json deleted file mode 100644 index bb21220..0000000 --- a/test/existing/11_en_US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "COMMON": { - "A_VIRTUAL_TRANSLATION": "A virtual translation", - "A_TRANSLATION": "Just a translation", - "A_VIRTUAL_LINK": "@:COMMON.A_VIRTUAL_TRANSLATION", - "A_TRUE_LINK": "@:COMMON.A_TRANSLATION" - } -} diff --git a/test/expected/00_fr_FR.json b/test/expected/00_fr_FR.json deleted file mode 100644 index 7c49fa1..0000000 --- a/test/expected/00_fr_FR.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", - "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": "", - "NONAMESPACE": "", - "SUB.NAMESPACE.VAL 1": "", - "SUB.NAMESPACE.VAL 2": "", - "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", - "SUB.NS.VAL 1.test 2": "", - "SUB.NS.vAL 0": "", - "all.toto.titi": "", - "all.tato.tIiti": "", - "all.tato.tati": "", - "all.tato.tbti": "", - "all.tato.tZti": "", - "all.tato.tdti": "", - "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", - "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" -} diff --git a/test/expected/01_fr_FR.json b/test/expected/01_fr_FR.json deleted file mode 100644 index 2c50e7c..0000000 --- a/test/expected/01_fr_FR.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "HtmlFilterSimpleQuoteOneTimeBinding": null, - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": null, - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": null, - "HtmlFilterDoubleQuote{} on same line 2/2": null, - "HtmlDirectiveKeyFromText": null, - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "My directive translation", - "HtmlDirective 2/2": null, - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": null, - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": null, - "NONAMESPACE": null, - "SUB.NAMESPACE.VAL 1": null, - "SUB.NAMESPACE.VAL 2": null, - "SUB.NS.VAL 1": null, - "SUB.NS.VAL 2": null, - "SUB.NS.VAL 1.test1": null, - "SUB.NS.VAL 1.test 2": null, - "SUB.NS.vAL 0": null, - "all.toto.titi": null, - "all.tato.tIiti": null, - "all.tato.tati": null, - "all.tato.tbti": null, - "all.tato.tZti": null, - "all.tato.tdti": null, - "all.tato.tzti": null, - "mySingleQ'uotedCommentTranslation '": null, - "myDoubleQuotedCommentTranslation \"e\"s\"": null, - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": null, - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": null, - "JavascriptServiceArraySimpleQuote 1/2 without var.": null, - "JavascriptServiceArraySimpleQuote 2/2 without var.": null, - "JavascriptServiceArrayDoubleQuote 1/2 without var.": null, - "JavascriptServiceArrayDoubleQuote 2/2 without var.": null, - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": null, - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": null, - "JavascriptFilter 1/2 with var \"{name}\"": "my {name} javascript filter", - "JavascriptFilter 2/2 without var": null -} diff --git a/test/expected/02_fr_FR.json b/test/expected/02_fr_FR.json deleted file mode 100644 index 81bf7ce..0000000 --- a/test/expected/02_fr_FR.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "My directive translation", - "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": "", - "NONAMESPACE": "", - "SUB.NAMESPACE.VAL 1": "", - "SUB.NAMESPACE.VAL 2": "", - "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", - "SUB.NS.VAL 1.test 2": "", - "SUB.NS.vAL 0": "", - "all.toto.titi": "", - "all.tato.tIiti": "", - "all.tato.tati": "", - "all.tato.tbti": "", - "all.tato.tZti": "", - "all.tato.tdti": "", - "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", - "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "my {name} javascript filter", - "JavascriptFilter 2/2 without var": "" -} diff --git a/test/expected/03_fr_FR.json b/test/expected/03_fr_FR.json deleted file mode 100644 index e5a791b..0000000 --- a/test/expected/03_fr_FR.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "HtmlFilterSimpleQuote[] interp'olation [[xx]]": "", - "HtmlFilterSimpleQuote[] on same line 1/2": "", - "HtmlFilterSimpleQuote[] on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", - "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": "", - "NONAMESPACE": "", - "SUB.NAMESPACE.VAL 1": "", - "SUB.NAMESPACE.VAL 2": "", - "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", - "SUB.NS.VAL 1.test 2": "", - "SUB.NS.vAL 0": "", - "all.toto.titi": "", - "all.tato.tIiti": "", - "all.tato.tati": "", - "all.tato.tbti": "", - "all.tato.tZti": "", - "all.tato.tdti": "", - "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", - "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" -} diff --git a/test/expected/04_en_US.json b/test/expected/04_en_US.json deleted file mode 100644 index 2fa9b9d..0000000 --- a/test/expected/04_en_US.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "HtmlFilterSimpleQuoteOneTimeBinding": "HtmlFilterSimpleQuoteOneTimeBinding", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "HtmlFilterDoubleQuote{} interp\"olation {{xx}}", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "HtmlFilterDoubleQuote{} {{var}}on same line 1/2", - "HtmlFilterDoubleQuote{} on same line 2/2": "HtmlFilterDoubleQuote{} on same line 2/2", - "HtmlDirectiveKeyFromText": "HtmlDirectiveKeyFromText", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô", - "HtmlDirective 2/2": "HtmlDirective 2/2", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": "HtmlDirectiveStandalone", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": "HtmlNgBindHtml Key ' 1/1", - "NONAMESPACE": "NONAMESPACE", - "SUB.NAMESPACE.VAL 1": "SUB.NAMESPACE.VAL 1", - "SUB.NAMESPACE.VAL 2": "SUB.NAMESPACE.VAL 2", - "SUB.NS.VAL 1": "SUB.NS.VAL 1", - "SUB.NS.VAL 2": "SUB.NS.VAL 2", - "SUB.NS.VAL 1.test1": "SUB.NS.VAL 1.test1", - "SUB.NS.VAL 1.test 2": "SUB.NS.VAL 1.test 2", - "SUB.NS.vAL 0": "SUB.NS.vAL 0", - "all.toto.titi": "all.toto.titi", - "all.tato.tIiti": "all.tato.tIiti", - "all.tato.tati": "all.tato.tati", - "all.tato.tbti": "all.tato.tbti", - "all.tato.tZti": "all.tato.tZti", - "all.tato.tdti": "all.tato.tdti", - "all.tato.tzti": "all.tato.tzti", - "mySingleQ'uotedCommentTranslation '": "mySingleQ'uotedCommentTranslation '", - "myDoubleQuotedCommentTranslation \"e\"s\"": "myDoubleQuotedCommentTranslation \"e\"s\"", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "JavascriptServiceArraySimpleQuote 1/2 without var.", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "JavascriptServiceArraySimpleQuote 2/2 without var.", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "JavascriptServiceArrayDoubleQuote 1/2 without var.", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "JavascriptServiceArrayDoubleQuote 2/2 without var.", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".", - "JavascriptFilter 1/2 with var \"{name}\"": "JavascriptFilter 1/2 with var \"{name}\"", - "JavascriptFilter 2/2 without var": "JavascriptFilter 2/2 without var" -} diff --git a/test/expected/04_fr_FR.json b/test/expected/04_fr_FR.json deleted file mode 100644 index 7c49fa1..0000000 --- a/test/expected/04_fr_FR.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", - "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": "", - "NONAMESPACE": "", - "SUB.NAMESPACE.VAL 1": "", - "SUB.NAMESPACE.VAL 2": "", - "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", - "SUB.NS.VAL 1.test 2": "", - "SUB.NS.vAL 0": "", - "all.toto.titi": "", - "all.tato.tIiti": "", - "all.tato.tati": "", - "all.tato.tbti": "", - "all.tato.tZti": "", - "all.tato.tdti": "", - "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", - "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" -} diff --git a/test/expected/05_en_US.json b/test/expected/05_en_US.json deleted file mode 100644 index 582e960..0000000 --- a/test/expected/05_en_US.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "HtmlFilterSimpleQuoteOneTimeBinding": "HtmlFilterSimpleQuoteOneTimeBinding", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "HtmlFilterDoubleQuote{} interp\"olation {{xx}}", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "HtmlFilterDoubleQuote{} {{var}}on same line 1/2", - "HtmlFilterDoubleQuote{} on same line 2/2": "HtmlFilterDoubleQuote{} on same line 2/2", - "HtmlDirectiveKeyFromText": "HtmlDirectiveKeyFromText", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô", - "HtmlDirective 2/2": "HtmlDirective 2/2", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": "HtmlDirectiveStandalone", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": "HtmlNgBindHtml Key ' 1/1", - "NONAMESPACE": "NONAMESPACE", - "SUB.NAMESPACE.VAL 1": "SUB.NAMESPACE.VAL 1", - "SUB.NAMESPACE.VAL 2": "SUB.NAMESPACE.VAL 2", - "SUB.NS.VAL 1": "SUB.NS.VAL 1", - "SUB.NS.VAL 2": "SUB.NS.VAL 2", - "SUB.NS.VAL 1.test1": "SUB.NS.VAL 1.test1", - "SUB.NS.VAL 1.test 2": "SUB.NS.VAL 1.test 2", - "SUB.NS.vAL 0": "SUB.NS.vAL 0", - "all.toto.titi": "all.toto.titi", - "all.tato.tIiti": "all.tato.tIiti", - "all.tato.tati": "all.tato.tati", - "all.tato.tbti": "all.tato.tbti", - "all.tato.tZti": "all.tato.tZti", - "all.tato.tdti": "all.tato.tdti", - "all.tato.tzti": "all.tato.tzti", - "mySingleQ'uotedCommentTranslation '": "mySingleQ'uotedCommentTranslation '", - "myDoubleQuotedCommentTranslation \"e\"s\"": "myDoubleQuotedCommentTranslation \"e\"s\"", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "JavascriptServiceArraySimpleQuote 1/2 without var.", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "JavascriptServiceArraySimpleQuote 2/2 without var.", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "JavascriptServiceArrayDoubleQuote 1/2 without var.", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "JavascriptServiceArrayDoubleQuote 2/2 without var.", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".", - "JavascriptFilter 1/2 with var \"{name}\"": "JavascriptFilter 1/2 with var \"{name}\"", - "JavascriptFilter 2/2 without var": "JavascriptFilter 2/2 without var", - "config:translation 00": "config:translation 00", - "config:translation 01": "config:translation 01", - "config:translation 02": "config:translation 02", - "config:translation 03": "config:translation 03" -} diff --git a/test/expected/06_fr_FR.json b/test/expected/06_fr_FR.json deleted file mode 100644 index bfde53b..0000000 --- a/test/expected/06_fr_FR.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "NONAMESPACE": "", - "SUB": { - "NAMESPACE": { - "VAL 1": "", - "VAL 2": "" - }, - "NS": { - "VAL 2": "", - "VAL 1": { - "test1": "", - "test 2": "" - } - } - } -} diff --git a/test/expected/07_en_US.json b/test/expected/07_en_US.json deleted file mode 100644 index d15b34f..0000000 --- a/test/expected/07_en_US.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "NONAMESPACE": null, - "SUB": { - "NAMESPACE": { - "VAL 1": null, - "VAL 2": null - }, - "NS": { - "VAL 2": null, - "VAL 1": { - "test1": null, - "test 2": null - } - } - } -} diff --git a/test/expected/07_fr_FR.json b/test/expected/07_fr_FR.json deleted file mode 100644 index 3fa852b..0000000 --- a/test/expected/07_fr_FR.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "NONAMESPACE": "NONAMESPACE", - "SUB": { - "NAMESPACE": { - "VAL 1": "SUB.NAMESPACE.VAL 1", - "VAL 2": "SUB.NAMESPACE.VAL 2" - }, - "NS": { - "VAL 2": "SUB.NS.VAL 2", - "VAL 1": { - "test1": "SUB.NS.VAL 1.test1", - "test 2": "SUB.NS.VAL 1.test 2" - } - } - } -} diff --git a/test/expected/08_fr_FR.json b/test/expected/08_fr_FR.json deleted file mode 100644 index 7fd3bd7..0000000 --- a/test/expected/08_fr_FR.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "NONAMESPACE": "NONAMESPACE", - "SUB": { - "NAMESPACE": { - "VAL 1": "My default SUB.NAMESPACE.VAL 1", - "VAL 2": "Waouhh!" - }, - "NS": { - "VAL 2": "SUB.NS.VAL 2", - "VAL 1": { - "test1": "SUB.NS.VAL 1.test1", - "test 2": "SUB.NS.VAL 1.test 2" - } - } - } -} diff --git a/test/expected/09_A_fr_FR.json b/test/expected/09_A_fr_FR.json deleted file mode 100644 index 21aa3de..0000000 --- a/test/expected/09_A_fr_FR.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "all": { - "tato": { - "tati": "all.tato.tati", - "tbti": "all.tato.tbti", - "tdti": "all.tato.tdti", - "tIiti": "all.tato.tIiti", - "tzti": "all.tato.tzti", - "tZti": "all.tato.tZti" - }, - "toto": { - "titi": "all.toto.titi" - } - }, - "SUB": { - "NAMESPACE": { - "VAL 1": "My default SUB.NAMESPACE.VAL 1", - "VAL 2": "Waouhh!" - }, - "NS": { - "vAL 0": "SUB.NS.vAL 0", - "VAL 1": { - "test 2": "SUB.NS.VAL 1.test 2", - "test1": "SUB.NS.VAL 1.test1" - }, - "VAL 2": "SUB.NS.VAL 2" - } - } -} diff --git a/test/expected/09_B_fr_FR.json b/test/expected/09_B_fr_FR.json deleted file mode 100644 index a0a2fd8..0000000 --- a/test/expected/09_B_fr_FR.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "SUB": { - "NAMESPACE": { - "VAL 1": "My default SUB.NAMESPACE.VAL 1", - "VAL 2": "Waouhh!" - }, - "NS": { - "VAL 1": { - "test 2": "SUB.NS.VAL 1.test 2", - "test1": "SUB.NS.VAL 1.test1" - }, - "VAL 2": "SUB.NS.VAL 2", - "vAL 0": "SUB.NS.vAL 0" - } - }, - "all": { - "tato": { - "tIiti": "all.tato.tIiti", - "tZti": "all.tato.tZti", - "tati": "all.tato.tati", - "tbti": "all.tato.tbti", - "tdti": "all.tato.tdti", - "tzti": "all.tato.tzti" - }, - "toto": { - "titi": "all.toto.titi" - } - } -} diff --git a/test/expected/10_1_fr_FR.json b/test/expected/10_1_fr_FR.json deleted file mode 100644 index 8500907..0000000 --- a/test/expected/10_1_fr_FR.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", - "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": "", - "MY_CUSTOM_EXTRA_TRANSLATION_01": "", - "MY_CUSTOM_EXTRA_TRANSLATION_02": "", - "NONAMESPACE": "", - "SUB.NAMESPACE.VAL 1": "", - "SUB.NAMESPACE.VAL 2": "", - "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", - "SUB.NS.VAL 1.test 2": "", - "SUB.NS.vAL 0": "", - "all.toto.titi": "", - "all.tato.tIiti": "", - "all.tato.tati": "", - "all.tato.tbti": "", - "all.tato.tZti": "", - "all.tato.tdti": "", - "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", - "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" -} diff --git a/test/expected/10_fr_FR.json b/test/expected/10_fr_FR.json deleted file mode 100644 index 173d0fc..0000000 --- a/test/expected/10_fr_FR.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "HtmlFilterSimpleQuoteOneTimeBinding": "", - "HtmlFilterDoubleQuote{} interp\"olation {{xx}}": "", - "HtmlFilterDoubleQuote{} {{var}}on same line 1/2": "", - "HtmlFilterDoubleQuote{} on same line 2/2": "", - "HtmlDirectiveKeyFromText": "", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "", - "HtmlDirective 2/2": "", - "HtmlDirectiveSimpleQuoteStandalone": "test 01", - "HtmlDirectivePluralSecond": "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}", - "HtmlDirectivePluralFirst": "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}", - "HtmlDirectiveStandalone": "", - "HtmlDirectiveDoubleQuoteStandalone": "test 02", - "HtmlNgBindHtml Key ' 1/1": "", - "MY.CUSTOM.REGEX": "", - "NONAMESPACE": "", - "SUB.NAMESPACE.VAL 1": "", - "SUB.NAMESPACE.VAL 2": "", - "SUB.NS.VAL 1": "", - "SUB.NS.VAL 2": "", - "SUB.NS.VAL 1.test1": "", - "SUB.NS.VAL 1.test 2": "", - "SUB.NS.vAL 0": "", - "all.toto.titi": "", - "all.tato.tIiti": "", - "all.tato.tati": "", - "all.tato.tbti": "", - "all.tato.tZti": "", - "all.tato.tdti": "", - "all.tato.tzti": "", - "mySingleQ'uotedCommentTranslation '": "", - "myDoubleQuotedCommentTranslation \"e\"s\"": "", - "JavascriptServiceSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptServiceArraySimpleQuote 1/2 without var.": "", - "JavascriptServiceArraySimpleQuote 2/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 1/2 without var.": "", - "JavascriptServiceArrayDoubleQuote 2/2 without var.": "", - "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\".": "", - "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".": "", - "JavascriptFilter 1/2 with var \"{name}\"": "", - "JavascriptFilter 2/2 without var": "" -} diff --git a/test/expected/11_en_US.json b/test/expected/11_en_US.json deleted file mode 100644 index 8488eae..0000000 --- a/test/expected/11_en_US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "COMMON": { - "A_VIRTUAL_TRANSLATION": "A virtual translation", - "A_VIRTUAL_LINK": "@:COMMON.A_VIRTUAL_TRANSLATION", - "A_TRANSLATION": "Just a translation", - "A_TRUE_LINK": "@:COMMON.A_TRANSLATION" - } -} diff --git a/test/expected/12_en_US.json b/test/expected/12_en_US.json deleted file mode 100644 index 4b8beb0..0000000 --- a/test/expected/12_en_US.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "This is text to translate": "This is text to translate", - "But I want to have the text as a key": "But I want to have the text as a key", - "For example this paragraph will be a key and value for default language": "For example this paragraph will be a key and value for default language" -} diff --git a/test/expected/13_fr_FR.json b/test/expected/13_fr_FR.json deleted file mode 100644 index aefa6f9..0000000 --- a/test/expected/13_fr_FR.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "Update 03": "", - "New \\\"user 03": "", - "Update \\' 06": "", - "New user 06": "", - "Update 02": "", - "New user 02": "", - "TEST.Update.01": "", - "TEST.Update.New user 01": "", - "Update 05": "", - "New user 05": "", - "Update 04": "", - "New user 04": "" -} diff --git a/test/expected/template.pot b/test/expected/template.pot deleted file mode 100644 index bf511fb..0000000 --- a/test/expected/template.pot +++ /dev/null @@ -1,165 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Project-Id-Version: \n" - -msgctxt "" -msgid "all.tato.tati" -msgstr "" - -msgctxt "" -msgid "all.tato.tbti" -msgstr "" - -msgctxt "" -msgid "all.tato.tdti" -msgstr "" - -msgctxt "" -msgid "all.tato.tIiti" -msgstr "" - -msgctxt "" -msgid "all.tato.tZti" -msgstr "" - -msgctxt "" -msgid "all.tato.tzti" -msgstr "" - -msgctxt "" -msgid "all.toto.titi" -msgstr "" - -msgctxt "" -msgid "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô" -msgstr "" - -msgctxt "" -msgid "HtmlDirective 2/2" -msgstr "" - -msgctxt "" -msgid "HtmlDirectiveDoubleQuoteStandalone" -msgstr "test 02" - -msgctxt "" -msgid "HtmlDirectiveKeyFromText" -msgstr "" - -msgctxt "" -msgid "HtmlDirectivePluralFirst" -msgstr "{NB, plural, one{HtmlDirectivePluralFirst for one!} other{# HtmlDirectivePluralFirst for others!}}" - -msgctxt "" -msgid "HtmlDirectivePluralSecond" -msgstr "{NB, plural, one{HtmlDirectivePluralSecond for one!} other{# HtmlDirectivePluralSecond for others!}}" - -msgctxt "" -msgid "HtmlDirectiveSimpleQuoteStandalone" -msgstr "test 01" - -msgctxt "" -msgid "HtmlDirectiveStandalone" -msgstr "" - -msgctxt "" -msgid "HtmlFilterDoubleQuote{} {{var}}on same line 1/2" -msgstr "" - -msgctxt "" -msgid "HtmlFilterDoubleQuote{} interp\"olation {{xx}}" -msgstr "" - -msgctxt "" -msgid "HtmlFilterDoubleQuote{} on same line 2/2" -msgstr "" - -msgctxt "" -msgid "HtmlFilterSimpleQuoteOneTimeBinding" -msgstr "" - -msgctxt "" -msgid "HtmlNgBindHtml Key ' 1/1" -msgstr "" - -msgctxt "" -msgid "JavascriptFilter 1/2 with var \"{name}\"" -msgstr "" - -msgctxt "" -msgid "JavascriptFilter 2/2 without var" -msgstr "" - -msgctxt "" -msgid "JavascriptServiceArrayDoubleQuote 1/2 without var." -msgstr "" - -msgctxt "" -msgid "JavascriptServiceArrayDoubleQuote 2/2 without var." -msgstr "" - -msgctxt "" -msgid "JavascriptServiceArraySimpleQuote 1/2 without var." -msgstr "" - -msgctxt "" -msgid "JavascriptServiceArraySimpleQuote 2/2 without var." -msgstr "" - -msgctxt "" -msgid "JavascriptServiceDoubleQuote 2/2 with var \"{name}\"." -msgstr "" - -msgctxt "" -msgid "JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\"." -msgstr "" - -msgctxt "" -msgid "JavascriptServiceInstantSimpleQuote 1/2 with var \"{name}\"." -msgstr "" - -msgctxt "" -msgid "JavascriptServiceSimpleQuote 1/2 with var \"{name}\"." -msgstr "" - -msgctxt "" -msgid "myDoubleQuotedCommentTranslation \"e\"s\"" -msgstr "" - -msgctxt "" -msgid "mySingleQ'uotedCommentTranslation '" -msgstr "" - -msgctxt "" -msgid "NONAMESPACE" -msgstr "" - -msgctxt "" -msgid "SUB.NAMESPACE.VAL 1" -msgstr "" - -msgctxt "" -msgid "SUB.NAMESPACE.VAL 2" -msgstr "" - -msgctxt "" -msgid "SUB.NS.vAL 0" -msgstr "" - -msgctxt "" -msgid "SUB.NS.VAL 1" -msgstr "" - -msgctxt "" -msgid "SUB.NS.VAL 1.test 2" -msgstr "" - -msgctxt "" -msgid "SUB.NS.VAL 1.test1" -msgstr "" - -msgctxt "" -msgid "SUB.NS.VAL 2" -msgstr "" diff --git a/test/fixtures/config.json b/test/fixtures/config.json deleted file mode 100644 index 8d2933d..0000000 --- a/test/fixtures/config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "config": { - "label": "config:translation 00", - "array": [ - { - "label": "config:translation 01" - }, - { - "label": "config:translation 02" - } - ], - "level": { - "label": "config:translation 03" - } - } -} \ No newline at end of file diff --git a/test/fixtures/default_deleted_i18n.json b/test/fixtures/default_deleted_i18n.json deleted file mode 100644 index ac8db9b..0000000 --- a/test/fixtures/default_deleted_i18n.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "HtmlFilterDoubleQuote{} interp\\\"olation {{xx}}": "My interpolation translation", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "My directive translation", - "JavascriptFilter 1/2 with var \"{name}\"": "my {name} javascript filter", - "myDeleted value": "N'importe quoi!" -} \ No newline at end of file diff --git a/test/fixtures/default_exists_i18n.json b/test/fixtures/default_exists_i18n.json deleted file mode 100644 index 24bbe42..0000000 --- a/test/fixtures/default_exists_i18n.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "HtmlFilterDoubleQuote{} interp\\\"olation {{xx}}": "My interpolation translation", - "HtmlDirective 1/2 &é\"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô": "My directive translation", - "JavascriptFilter 1/2 with var \"{name}\"": "my {name} javascript filter" -} \ No newline at end of file diff --git a/test/fixtures/default_exists_i18n_namespace.json b/test/fixtures/default_exists_i18n_namespace.json deleted file mode 100644 index 5648d34..0000000 --- a/test/fixtures/default_exists_i18n_namespace.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "SUB": { - "NAMESPACE": { - "VAL 1": "My default SUB.NAMESPACE.VAL 1", - "VAL 2": "Waouhh!" - }, - "NS": "" - } -} \ No newline at end of file diff --git a/test/fixtures/index.html b/test/fixtures/index.html deleted file mode 100644 index 235cf00..0000000 --- a/test/fixtures/index.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - grunt-angular-translate test page - - - - - - -
-

[['HtmlFilterSimpleQuote[] interp\'olation [[xx]]' | translate ]]

-

[['HtmlFilterSimpleQuote[] on same line 1/2'| translate:'{var : 1}']] - [['HtmlFilterSimpleQuote[] on same line 2/2'|translate]]

[[angularJSNumber]] -
- - -
-

{{ ::'HtmlFilterSimpleQuoteOneTimeBinding' | translate }}

-
- - -
-

{{"HtmlFilterDoubleQuote{} interp\"olation {{xx}}" | translate }}

-

{{"HtmlFilterDoubleQuote{} {{var}}on same line 1/2"| translate:'{var : 1}'}} - {{"HtmlFilterDoubleQuote{} on same line 2/2"|translate}}

{{angularJSNumber}} -
- - -
-

Our title text

- - - HtmlDirectiveKeyFromText - HtmlDirectiveKeyFromText - - test 01 - test 02 -
- - -{{ translate_function('MY_CUSTOM_EXTRA_TRANSLATION_01') }} -{{ translate_function("MY_CUSTOM_EXTRA_TRANSLATION_02") }} - - -

- -

- - -

- HtmlDirective 1/2 &é"'(-è_çà)=$^ù!:;,}@^`[{#~@Ùô - HtmlDirective 2/2 -

- - -

- HtmlDirective translate in string -

- - - - \ No newline at end of file diff --git a/test/fixtures/index_key_as_text.html b/test/fixtures/index_key_as_text.html deleted file mode 100644 index 1dc501e..0000000 --- a/test/fixtures/index_key_as_text.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - grunt-angular-translate test page - - - -

This is text to translate

-

But I want to have the text as a key

-

For example this paragraph will be a key and value for default language

- - - \ No newline at end of file diff --git a/test/fixtures/index_namespace.html b/test/fixtures/index_namespace.html deleted file mode 100644 index b140207..0000000 --- a/test/fixtures/index_namespace.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - grunt-angular-translate test page - - - - - - -

- NONAMESPACE - SUB.NAMESPACE.VAL 1 - SUB.NAMESPACE.VAL 2 - SUB.NS.VAL 1 - SUB.NS.VAL 2 - SUB.NS.VAL 1.test1 - SUB.NS.VAL 1.test 2 -

- - - - \ No newline at end of file diff --git a/test/fixtures/index_namespace_consistent_output.html b/test/fixtures/index_namespace_consistent_output.html deleted file mode 100644 index 83735d5..0000000 --- a/test/fixtures/index_namespace_consistent_output.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - grunt-angular-translate test page - - - - - - -

- SUB.NS.VAL 1 - SUB.NS.VAL 2 - SUB.NS.VAL 1.test1 - SUB.NS.VAL 1.test 2 - SUB.NS.vAL 0 - SUB.NS.VAL 1.test 2 - all.toto.titi - SUB.NS.VAL 1.test 2 - all.tato.tIiti - SUB.NS.VAL 1.test 2 - all.tato.tati - SUB.NS.VAL 1.test 2 - all.tato.tbti - SUB.NS.VAL 1.test 2 - all.tato.tZti - SUB.NS.VAL 1.test 2 - all.tato.tdti - SUB.NS.VAL 1.test 2 - all.tato.tzti - SUB.NS.VAL 1.test 2 -

- - - - \ No newline at end of file diff --git a/test/fixtures/index_ternary_keys.html b/test/fixtures/index_ternary_keys.html deleted file mode 100644 index 0b18dd6..0000000 --- a/test/fixtures/index_ternary_keys.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - grunt-angular-translate test page - - - - - - -

-

{{edit ? 'Update 02' : 'New user 02'}}

-

{{edit ? "Update 03" : "New \"user 03" | translate}}

-{{ translate_function(edit ? 'Update 04' : 'New user 04') }} - -

- - - - \ No newline at end of file diff --git a/test/fixtures/links.js b/test/fixtures/links.js deleted file mode 100644 index 9d2a601..0000000 --- a/test/fixtures/links.js +++ /dev/null @@ -1,17 +0,0 @@ -angular.module('linkService', []) - - .factory('linkService', function ($state, $document, $filter, $translate) { - var linkService = { - getTest: function () { - $translate([ - 'COMMON.A_VIRTUAL_LINK', - 'COMMON.A_TRANSLATION', - 'COMMON.A_TRUE_LINK', - ]).then(function (translations) { - console.log(translations); - }); - } - }; - - return linkService; - }); diff --git a/test/fixtures/titleService.js b/test/fixtures/titleService.js deleted file mode 100644 index a331e68..0000000 --- a/test/fixtures/titleService.js +++ /dev/null @@ -1,35 +0,0 @@ -angular.module('titleService', []) - - .factory('titleService', function ($state, $document, $filter, $translate) { - - $state.state('home', { - url: '/home', - data: { - pageTitleSimple: /* i18nextract */'mySingleQ\'uotedCommentTranslation \'', - pageTitleDouble: /* i18nextract */"myDoubleQuotedCommentTranslation \"e\"s\"" - } - }); - - $filter('translate')('JavascriptFilter 1/2 with var "{name}"', {name: 'name'}); - $filter('translate')('JavascriptFilter 2/2 without var'); - - $translate('JavascriptServiceSimpleQuote 1/2 with var "{name}".', {name: 'name'}); - $translate("JavascriptServiceDoubleQuote 2/2 with var \"{name}\".", {name: 'name'}); - $translate.instant('JavascriptServiceInstantSimpleQuote 1/2 with var "{name}".', {name: 'name'}); - $translate.instant("JavascriptServiceInstantDoubleQuote 2/2 with var \"{name}\".", {name: 'name'}); - - $translate([ - 'JavascriptServiceArraySimpleQuote 1/2 without var.', - 'JavascriptServiceArraySimpleQuote 2/2 without var.' - ]); - - $translate(["JavascriptServiceArrayDoubleQuote 1/2 without var.", "JavascriptServiceArrayDoubleQuote 2/2 without var."]); - - var titleService = { - }; - - return titleService; - }) - -; - diff --git a/test/utils_test.js b/test/utils_test.js deleted file mode 100644 index 93ebc23..0000000 --- a/test/utils_test.js +++ /dev/null @@ -1,157 +0,0 @@ -'use strict' - -var grunt = require('grunt') -var _ = require('lodash') -var path = require('path') -var Utils = require('../lib/utils.js') -var stringify = require('json-stable-stringify') -var expand = require('glob-expand') - -exports.utils = { - - setUp: function (callback) { - this._basePath = __dirname - this.utils = new Utils({ - basePath: __dirname - }) - - this.JSONObject = { - "MY.KEY.INDEX": "VALUE" - } - - callback() - }, - - /**************************************************************************** - * utils.customStringify tests - ***************************************************************************/ - customStringify_nooptions: function(test) { - test.expect(1) - test.equal(this.utils.customStringify(this.JSONObject), JSON.stringify(this.JSONObject, null , 4)) - test.done() - }, - customStringify_defaultoptions: function(test) { - test.expect(1) - var defaultOptions = { - space: ' ', - cmp: function (a, b) { - var lower = function (a) { - return a.toLowerCase() - } - return lower(a.key) < lower(b.key) ? -1 : 1 - } - } - test.equal(this.utils.customStringify(this.JSONObject, true), stringify(this.JSONObject, defaultOptions)) - test.done() - }, - customStringify_customoptions: function(test) { - test.expect(1) - var customOptions = { - space: ' ', - cmp: function (a, b) { - var lower = function (a) { - return a.toLowerCase() - } - return lower(a.key) < lower(b.key) ? -1 : 1 - } - } - test.equal(this.utils.customStringify(this.JSONObject, customOptions), stringify(this.JSONObject, customOptions)) - test.done() - }, - - /**************************************************************************** - * utils.getRealPath tests - ***************************************************************************/ - getRealPath_noerror: function(test) { - test.expect(1) - var filepath = 'my.file' - test.equal(this.utils.getRealPath(filepath), require('path').join(this._basePath, filepath)) - test.done() - }, - getRealPath_error: function(test) { - test.expect(1) - var filepath = true - test.equal(this.utils.getRealPath(filepath), filepath) - test.done() - }, - - /**************************************************************************** - * utils.expand tests - ***************************************************************************/ - expand_noerror: function(test) { - test.expect(1) - var filepattern = '**/*_test.js' - test.equal(this.utils.expand(filepattern).length, expand({cwd: this._basePath}, filepattern).length) - test.done() - }, - - /**************************************************************************** - * utils.escapeRegExp tests - ***************************************************************************/ - escapeRegExp_noerror: function(test) { - test.expect(1) - var strSource = 'Bonjour tous le monde! -[]{}()*+?.\\|$' - var strResult = 'Bonjour tous le monde! \\-\\[\\]\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\\|\\$' - test.equal(this.utils.escapeRegExp(strSource), strResult) - test.done() - }, - - /**************************************************************************** - * utils.extractTernaryKey tests - ***************************************************************************/ - extractTernaryKey_simpleQuote: function(test) { - test.expect(3) - var strSource = "myVar ? 'fi\\'rst':'second'" - var strResult = ["fi\\'rst", "second"] - var extract = this.utils.extractTernaryKey(strSource, { - startDelimiter: '{{', - endDelimiter: '}}' - }) - test.equal(extract.length, 2) - test.equal(extract[0], strResult[0]) - test.equal(extract[1], strResult[1]) - test.done() - }, - extractTernaryKey_doubleQuote: function(test) { - test.expect(3) - var strSource = 'myVar?"fi\\"rst": "second"' - var strResult = ['fi\\"rst', 'second'] - var extract = this.utils.extractTernaryKey(strSource, { - startDelimiter: '{{', - endDelimiter: '}}' - }) - test.equal(extract.length, 2) - test.equal(extract[0], strResult[0]) - test.equal(extract[1], strResult[1]) - test.done() - }, - extractTernaryKey_withAngularDelimiters: function(test) { - test.expect(3) - var strSource = '{{myVar?"fi\\"rst" :"second"}}' - var strResult = ['fi\\"rst', 'second'] - var extract = this.utils.extractTernaryKey(strSource, { - startDelimiter: '{{', - endDelimiter: '}}' - }) - test.equal(extract.length, 2) - test.equal(extract[0], strResult[0]) - test.equal(extract[1], strResult[1]) - test.done() - }, - extractTernaryKey_withAngularTranslate: function(test) { - test.expect(3) - var strSource = 'myVar?"fi\\"rst":"second" | translate' - var strResult = ['fi\\"rst', 'second'] - var extract = this.utils.extractTernaryKey(strSource, { - startDelimiter: '{{', - endDelimiter: '}}' - }) - test.equal(extract.length, 2) - test.equal(extract[0], strResult[0]) - test.equal(extract[1], strResult[1]) - test.done() - } - - - -} From cd301521bcec1c8ca9c20bad78a766bf63a1cc5e Mon Sep 17 00:00:00 2001 From: Benjamin LONGEARET Date: Wed, 2 Mar 2016 10:44:43 +0100 Subject: [PATCH 4/5] chore(grunt): Remove grunt --- Gruntfile.js | 86 ---------------------------------------------------- package.json | 12 -------- 2 files changed, 98 deletions(-) delete mode 100644 Gruntfile.js diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index dd71f89..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * grunt-angular-translate - * https://github.com/firehist/grunt-angular-translate - * - * Copyright (c) 2013 "firehist" Benjamin Longearet, contributors - * Licensed under the MIT license. - */ - -'use strict'; - -module.exports = function(grunt) { - - // Project configuration. - grunt.initConfig({ - jshint: { - all: [ - 'Gruntfile.js', - 'tasks/**/*.js', - '<%= nodeunit.tests %>' - ], - options: { - jshintrc: '.jshintrc' - } - }, - - // Before generating any new files, remove any previously-created files. - clean: { - tests: ['tmp'] - }, - - /** - * Increments the version number, etc. - */ - bump: { - options: { - files: [ - "package.json" - ], - commit: true, - commitMessage: 'chore(release): v%VERSION%', - commitFiles: [ - "package.json" - ], - createTag: true, - tagName: 'v%VERSION%', - tagMessage: 'Version %VERSION%', - push: true, - pushTo: 'origin' - } - }, - - // Unit tests. - nodeunit: { - tests: ['test/*_test.js'], - utils: ['test/utils_test.js'] - }, - - markdox: { - all: { - files: [ - {src: 'tasks/*.js', dest: 'DOCUMENTATION.md'} - ] - } - } - - }); - - // Actually load this plugin's task(s). - grunt.loadTasks('tasks'); - - // These plugins provide necessary tasks. - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-nodeunit'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-bump'); - grunt.loadNpmTasks('grunt-markdox'); - - // Whenever the "test" task is run, first clean the "tmp" dir, then run this - // plugin's task(s), then test the result. - grunt.registerTask('test', ['clean', 'nodeunit:tests', 'clean']); - - // By default, lint and run all tests. - grunt.registerTask('default', ['test']); - -}; diff --git a/package.json b/package.json index 3bd64c9..18584ef 100644 --- a/package.json +++ b/package.json @@ -25,22 +25,12 @@ "commitizen": "2.5.0", "coveralls": "2.11.8", "cz-conventional-changelog": "1.1.5", - "grunt": "~0.4.0", - "grunt-bump": "0.0.13", - "grunt-contrib-clean": "^0.5.0", - "grunt-contrib-copy": "^0.5.0", - "grunt-contrib-jshint": "^0.10.0", - "grunt-contrib-nodeunit": "^0.4.1", - "grunt-markdox": "^0.1.0", "istanbul": "0.4.2", "mocha": "2.4.5", "nodeunit": "^0.9.1", "semantic-release": "^4.3.5", "sinon": "1.17.3" }, - "peerDependencies": { - "grunt": ">=0.4.0" - }, "repository": { "type": "git", "url": "https://github.com/Boulangerie/angular-translate-extract.git" @@ -48,8 +38,6 @@ "keywords": [ "AngularJS", "angular-translate", - "gruntplugin", - "grunt", "javascript", "js", "translate", From 31d8f8d2e0f65c08f4fb6d690b6886f692b2ec61 Mon Sep 17 00:00:00 2001 From: Benjamin LONGEARET Date: Wed, 2 Mar 2016 11:50:10 +0100 Subject: [PATCH 5/5] test(project): Refactor due to coverage --- package.json | 4 ++-- src/index.js | 41 ++++++--------------------------- tests/adapter.spec.js | 14 ++++++++++++ tests/index.spec.js | 47 +++++++++++++++++++++++++++++++++++++- tests/translations.spec.js | 14 ++++++++++++ 5 files changed, 83 insertions(+), 37 deletions(-) create mode 100644 tests/adapter.spec.js diff --git a/package.json b/package.json index 18584ef..ccbeff0 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,14 @@ "commit": "git cz", "test": "mocha tests -w --compilers js:babel-register", "test:single": "babel-node node_modules/.bin/babel-istanbul cover _mocha -- tests -R spec", - "check-coverage": "istanbul check-coverage --statements 50 --branches 35 --functions 75 --lines 50", + "check-coverage": "istanbul check-coverage --statements 99 --branches 92 --functions 100 --lines 99", "report-coverage": "cat ./coverage/lcov.info | coveralls", "prebuild": "rm -Rf lib && mkdir lib", "build": "babel -d lib/ src/", "semantic-release": "semantic-release pre && npm publish && semantic-release post" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 4.0.0" }, "devDependencies": { "babel-cli": "6.5.1", diff --git a/src/index.js b/src/index.js index ac4018c..a153936 100644 --- a/src/index.js +++ b/src/index.js @@ -20,7 +20,7 @@ import {JsonAdapter} from './adapter/json-adapter.js' var extractor (function() { - var _basePath, _log, _utils + var _log, _utils var Extractor = function (data, option) { this.data = data @@ -28,9 +28,10 @@ var extractor // Grab NODE_ENV to set debug flag! var debug = process.env.NODE_ENV === 'debug' _log = new Log(option.log || (debug ? 'debug' : 'info')) - _basePath = option ? (option.basePath || __dirname) : __dirname + + this.basePath = (option && option.basePath) || __dirname _utils = new Utils({ - basePath: _basePath + basePath: this.basePath }) // Check lang parameter @@ -227,38 +228,9 @@ var extractor return currentArray } - /** - * Recurse feed translation object (utility for namespace) - * INPUT: {"NS1": {"NS2": {"VAL1": "", "VAL2": ""} } } - * OUTPUT: {"NS1": {"NS2": {"VAL1": "NS1.NS2.VAL1", "VAL2": "NS1.NS2.VAL2"} } } - * @param {Object} data - * @param {string?} path - * @private - */ - var _recurseFeedDefaultNamespace = function (data, path) { - var path = path || '' - if (_.isObject(data)) { - for (var key in data) { - if (_.isObject(data)) { - data[ key ] = _recurseFeedDefaultNamespace(data[ key ], path != '' ? path + '.' + key : key) - } - } - return data - } else { - if (data == null && data == "") { - // return default data if empty/null - return path - } else { - - return data - } - } - } - /** * Start extraction of translations */ - // Check directory exist try { fs.statSync(dest) @@ -336,16 +308,17 @@ var extractor switch(adapter) { case 'pot': - var toPot = new PotAdapter(_log, _basePath) + var toPot = new PotAdapter(_log, this.basePath) toPot.init(params) _translation.persist(toPot) break default: - var toJson = new JsonAdapter(_log, _basePath) + var toJson = new JsonAdapter(_log, this.basePath) toJson.init(params) _translation.persist(toJson) } + return this } module.exports = { diff --git a/tests/adapter.spec.js b/tests/adapter.spec.js new file mode 100644 index 0000000..ef79122 --- /dev/null +++ b/tests/adapter.spec.js @@ -0,0 +1,14 @@ +import {expect} from 'chai' +import Adapter from './../src/adapter/adapter' + +describe('adapter', () => { + it('should throw error when try to call the non-implemented persist method', () => { + let adapter = new Adapter(console, './') + let result = true + try { + adapter.persist() + result = false + } catch(e) {} + expect(result).to.be.true + }) +}) \ No newline at end of file diff --git a/tests/index.spec.js b/tests/index.spec.js index 0dafa30..5323b6b 100644 --- a/tests/index.spec.js +++ b/tests/index.spec.js @@ -8,6 +8,8 @@ import preset from './preset.conf.js' import pkg from '../package.json' describe('Extractor', () => { + let workingDir = path.resolve(__dirname, '..') + describe('Interface', () => { it('should expose the current version', () => { expect(AngularTranslateExtractor.VERSION).to.be.a('string') @@ -23,8 +25,51 @@ describe('Extractor', () => { }) }) + describe('extract()', () => { + + it('should throw an error when no lang in params', () => { + let result = true + try { + AngularTranslateExtractor.extract({}, { + "basePath": workingDir, + "log": false + }) + result = false + } catch (e) {} + expect(result).to.be.true + }) + + it('should run in debug mode', () => { + let result = true + let oldNodeEnv = process.env.NODE_ENV + process.env.NODE_ENV = 'debug' + try { + AngularTranslateExtractor.extract({ + lang: ['fr_FR'], + dest: 'tmp' + }, { + "basePath": workingDir, + "log": false + }) + } catch(e) { + result = false + } + expect(result).to.be.true + process.env.NODE_ENV = oldNodeEnv + }) + + it('should set default basePath if not given as input', () => { + let extractor = AngularTranslateExtractor.extract({ + lang: ['fr_FR'], + dest: 'tmp' + }, {"log": false}) + expect(extractor.basePath).to.be.a('string') + expect(extractor.basePath).equals(path.resolve(path.dirname('./src/index.js'))) + }) + + }) + describe('Preset', () => { - let workingDir = path.resolve(__dirname, '..') let getContent = (name, tmpDirectory = 'tmp/', expectedDirectory = 'tests/expected/') => { let encoding = {"encoding": 'utf8'} let tmp = fs.readFileSync(path.resolve(workingDir, tmpDirectory + name), encoding) diff --git a/tests/translations.spec.js b/tests/translations.spec.js index f740f2b..c72ae05 100644 --- a/tests/translations.spec.js +++ b/tests/translations.spec.js @@ -259,6 +259,20 @@ describe('Translations', () => { "NS.SNS2": "" }) }) + + it('should return merged translations (safeMode: false & useDefault:null)', () => { + translations.setTranslations({ + "NS.SNS1": "my translations", + "NS.SNS2": "" + }) + let result = translations.getMergedTranslations({ + "NS.SNS1": "my new translations" + }) + expect(result).to.deep.equal({ + "NS.SNS1": "my new translations", + "NS.SNS2": "" + }) + }) it('should take care about given link (@:)', () => { translations.setTranslations({ "NS.SNS1": "my translations",