google-spreadsheet-translation-sync 1.3.10 → 1.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/test/test.js +12 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-spreadsheet-translation-sync",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "description": "A plugin to read and write i18n translationsfrom and to google spreadsheets ",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test/test.js CHANGED
@@ -11,9 +11,9 @@ const async = require('async');
11
11
 
12
12
  const testSheetId = '1ZJK1G_3wrEo9lnu1FenjOzSy3uoAi-RLWbph1cI6DWI'; // https://docs.google.com/spreadsheets/d/1ZJK1G_3wrEo9lnu1FenjOzSy3uoAi-RLWbph1cI6DWI/edit#gid=0
13
13
  const testWorksheetId = '1209225803';
14
- const testSheetId_gettext = '1CRvX4TCxUGCcs_MtKC5BdEViHYzYzLXdqtbuVaAXfKc';
14
+ const testSheetId_gettext = '1CRvX4TCxUGCcs_MtKC5BdEViHYzYzLXdqtbuVaAXfKc'; // https://docs.google.com/spreadsheets/d/1CRvX4TCxUGCcs_MtKC5BdEViHYzYzLXdqtbuVaAXfKc/edit#gid=0
15
15
  const testSheetId_properties = '1Z0Mpbf6lgdGiuiHlpb9DENVfKxkxSRwcfQEDYrgokEE'; // https://docs.google.com/spreadsheets/d/1Z0Mpbf6lgdGiuiHlpb9DENVfKxkxSRwcfQEDYrgokEE/edit#gid=0
16
- const testSheetId_yaml = '1Ml3jLK6RgbPQ4e7XZpILvB-XWMeziHpwdxS8r4AYNtE';
16
+ const testSheetId_yaml = '1Ml3jLK6RgbPQ4e7XZpILvB-XWMeziHpwdxS8r4AYNtE'; // https://docs.google.com/spreadsheets/d/1Ml3jLK6RgbPQ4e7XZpILvB-XWMeziHpwdxS8r4AYNtE/edit#gid=0
17
17
  const timeout = 20000;
18
18
 
19
19
  // preparations
@@ -21,10 +21,6 @@ const timeout = 20000;
21
21
  var tmpFile = tmp.fileSync({postfix: '.csv'});
22
22
 
23
23
  const csv = require('fast-csv');
24
- const fileUtils = require("../src/util/file-utils");
25
- const yamlHandler = require("../src/handlers/yaml");
26
- const rimraf = require("rimraf");
27
- const yaml = require("js-yaml");
28
24
  const testFile = tmpFile.name;
29
25
  const csvData = [
30
26
  ['key', 'default', 'de', 'it', 'fr', 'pl', 'hu'],
@@ -323,12 +319,15 @@ const tests = [
323
319
 
324
320
  if (!err) {
325
321
  const testFile = path.resolve(translationRoot + '/other.properties');
322
+ const testFilePl = path.resolve(translationRoot + '/other_pl.properties');
326
323
  const PropertiesReader = require('properties-reader');
327
324
 
328
325
  const props = PropertiesReader(testFile);
326
+ const propsPl = PropertiesReader(testFilePl);
329
327
 
330
328
  // expect(Object.keys(props.getAllProperties()).length).to.equal(csvData.length - 1); // without the header
331
329
  expect(props.get(csvData[2][0])).to.equal(csvData[2][1]);
330
+ expect(propsPl.get(csvData[1][0])).to.equal(csvData[1][5]);
332
331
  }
333
332
 
334
333
  done();
@@ -352,15 +351,18 @@ const tests = [
352
351
 
353
352
  const translationRoot = ensureFolder(path.resolve('./test/translations/' + options.translationFormat + '/'));
354
353
  const testFile = path.resolve(translationRoot + '/default.json');
354
+ const testFilePl = path.resolve(translationRoot + '/pl.json');
355
355
 
356
356
  app.importFromSpreadsheet(translationRoot, options, function (err) {
357
357
  expect(err).to.be.null
358
358
 
359
359
  if (!err) {
360
360
  const defaultKeys = require(testFile);
361
+ const plKeys = require(testFilePl);
361
362
 
362
363
  // expect(Object.keys(defaultKeys).length).to.equal(326);
363
364
  expect(defaultKeys[csvData[2][0]]).to.equal(csvData[2][1]);
365
+ expect(plKeys[csvData[1][0]]).to.equal(csvData[1][5]);
364
366
  }
365
367
 
366
368
  done();
@@ -385,6 +387,7 @@ const tests = [
385
387
 
386
388
  const translationRoot = ensureFolder(path.resolve('./test/translations/' + options.translationFormat + '/'));
387
389
  const testFile = path.resolve(translationRoot + '/' + baseName + '-en.po');
390
+ const testFilePl = path.resolve(translationRoot + '/' + baseName + '-pl.po');
388
391
 
389
392
  app.importFromSpreadsheet(translationRoot, options, function (err) {
390
393
  expect(err).to.be.null
@@ -395,9 +398,11 @@ const tests = [
395
398
  expect(fs.existsSync(testFile)).to.equal(true);
396
399
 
397
400
  const po = require('gettext-parser').po.parse(fs.readFileSync(testFile));
401
+ const poPl = require('gettext-parser').po.parse(fs.readFileSync(testFilePl));
398
402
  const translations = po.translations[''];
399
-
403
+ const translationsPl = poPl.translations[''];
400
404
  expect(translations.add_address.msgstr[0]).to.equal("Add new address");
405
+ expect(translationsPl['additional.news'].msgstr[0]).to.equal('czecz 2242');
401
406
  }
402
407
 
403
408
  done();