google-spreadsheet-translation-sync 1.3.8 → 1.3.10

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.
package/README.md CHANGED
@@ -20,8 +20,15 @@ gsTransSync.exportToSpreadsheet(['de.json', 'en.json'], options, callback);
20
20
  gsTransSync.importFromSpreadsheet('your/folder', { spreadsheetId: 'xxxxxxx'}, function () {
21
21
  // done :)
22
22
  });
23
-
24
23
  ```
24
+
25
+ On the Google spreadsheets side, this needs to have the following structure:
26
+
27
+ |key|default|de|en|... any other locale|<locale> # <comment>|
28
+ |---|---|---|---|---|---|
29
+ |test.something|Test Schlüssel|Test Key|****||
30
+
31
+ Please not the line `<locale> # <comment>` - `# <comment>` will be ignored in uploads and downloads, so you can put some information for your translators into the google doc (They will do it anyway, so this way you don't need to remove the comment before import).
25
32
 
26
33
  ### Options
27
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-spreadsheet-translation-sync",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "A plugin to read and write i18n translationsfrom and to google spreadsheets ",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -160,7 +160,9 @@ module.exports = function (translationFiles, options, callback) {
160
160
 
161
161
  // this is the header row
162
162
  if (cell.value) {
163
- headerIndexMap[cellIndex] = keyIndexMap[cell.value];
163
+ // clear comments from the header name
164
+ let cleanLocale = cell.value.split('#')[0].trim();
165
+ headerIndexMap[cellIndex] = keyIndexMap[cleanLocale];
164
166
  maxIndex = cellIndex
165
167
  } else {
166
168
  // this looks like an initial upload, let's do it
@@ -42,6 +42,9 @@ module.exports = function (translationRootFolder, options, callback) {
42
42
 
43
43
  if (rowIndex === 0) {
44
44
  if (val) {
45
+ // clear comments from the header
46
+ val = val.split('#')[0].trim();
47
+
45
48
  headers[cellIndex] = val;
46
49
  if (cellIndex > keyCellIndex) {
47
50
  translationData[val] = {};
package/test/test.js CHANGED
@@ -9,10 +9,10 @@ const accessData = require('./data/google-test-access.json');
9
9
  const tmp = require('tmp');
10
10
  const async = require('async');
11
11
 
12
- const testSheetId = '1ZJK1G_3wrEo9lnu1FenjOzSy3uoAi-RLWbph1cI6DWI';
12
+ const testSheetId = '1ZJK1G_3wrEo9lnu1FenjOzSy3uoAi-RLWbph1cI6DWI'; // https://docs.google.com/spreadsheets/d/1ZJK1G_3wrEo9lnu1FenjOzSy3uoAi-RLWbph1cI6DWI/edit#gid=0
13
13
  const testWorksheetId = '1209225803';
14
14
  const testSheetId_gettext = '1CRvX4TCxUGCcs_MtKC5BdEViHYzYzLXdqtbuVaAXfKc';
15
- const testSheetId_properties = '1Z0Mpbf6lgdGiuiHlpb9DENVfKxkxSRwcfQEDYrgokEE';
15
+ const testSheetId_properties = '1Z0Mpbf6lgdGiuiHlpb9DENVfKxkxSRwcfQEDYrgokEE'; // https://docs.google.com/spreadsheets/d/1Z0Mpbf6lgdGiuiHlpb9DENVfKxkxSRwcfQEDYrgokEE/edit#gid=0
16
16
  const testSheetId_yaml = '1Ml3jLK6RgbPQ4e7XZpILvB-XWMeziHpwdxS8r4AYNtE';
17
17
  const timeout = 20000;
18
18
 
@@ -202,7 +202,7 @@ const tests = [
202
202
  }).then(function (rows) {
203
203
  expect(rows).to.have.lengthOf((csvData.length - 1) * 2);
204
204
  expect(rows[0][options.keyId]).to.equal(csvData[1][0]);
205
- expect(rows[0].pl).to.equal(csvData[1][5]);
205
+ expect(rows[0]['pl # with comment']).to.equal(csvData[1][5]);
206
206
  expect(rows[0].default).to.equal(csvData[1][1]);
207
207
  expect(rows[0].hu).to.equal('Elfogadom');
208
208
  expect(rows[0].namespace).to.equal(namespaces[0]);
@@ -281,7 +281,7 @@ const tests = [
281
281
  }).then(function (rows) {
282
282
  expect(rows).to.have.lengthOf(csvData.length - 1);
283
283
  expect(rows[0][options.keyId]).to.equal(csvData[1][0]);
284
- expect(rows[0].pl).to.equal(csvData[1][5]);
284
+ expect(rows[0]['pl # with comment']).to.equal(csvData[1][5]);
285
285
  expect(rows[0].default).to.equal(csvData[1][1]);
286
286
  expect(rows[0].hu).to.equal('Elfogadom'); // this was not part of the upload and should not be overwrittem
287
287
  expect(rows[1].default).to.equal(csvData[2][1]);
@@ -462,7 +462,7 @@ const tests = [
462
462
  }).then(function (rows) {
463
463
  expect(rows).to.have.lengthOf(csvData.length - 1);
464
464
  expect(rows[0][options.keyId]).to.equal(csvData[1][0]);
465
- expect(rows[0].pl).to.equal(csvData[1][5]);
465
+ expect(rows[0]['pl # with comment']).to.equal(csvData[1][5]);
466
466
  expect(rows[0].default).to.equal(csvData[1][1]);
467
467
  expect(rows[0].hu).to.equal('Elfogadom'); // this was not part of the upload and should not be overwrittem
468
468
  expect(rows[1].default).to.equal(csvData[2][1]);
@@ -575,7 +575,7 @@ const tests = [
575
575
  }).then(function (rows) {
576
576
  expect(rows).to.have.lengthOf(csvData.length - 1);
577
577
  expect(rows[0][options.keyId]).to.equal(csvData[1][0]);
578
- expect(rows[0].pl).to.equal(csvData[1][5]);
578
+ expect(rows[0]['pl # with comment']).to.equal(csvData[1][5]);
579
579
  expect(rows[0].default).to.equal(csvData[1][1]);
580
580
  expect(rows[0].hu).to.equal('Elfogadom'); // this was not part of the upload and should not be overwrittem
581
581
  expect(rows[1].default).to.equal(csvData[2][1]);