Skip to content

Commit

Permalink
Add multiple comments to test suite
Browse files Browse the repository at this point in the history
Remove odd choice where extracted comments
where added to translator comments
  • Loading branch information
Bertg committed Nov 11, 2020
1 parent d060297 commit e336aff
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 14 deletions.
63 changes: 56 additions & 7 deletions packages/cli/src/api/__snapshots__/catalog.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ Object {
],
},
Hello World: Object {
extractedComments: Array [],
extractedComments: Array [
Comment A,
Hello comment,
],
origin: Array [
Array [
collect/componentA/componentA.js,
2,
],
Array [
collect/componentA/index.js,
1,
Expand Down Expand Up @@ -59,10 +66,17 @@ Object {
},
Hello World: Object {
comments: Array [],
extractedComments: Array [],
extractedComments: Array [
Comment A,
Hello comment,
],
flags: Array [],
obsolete: false,
origin: Array [
Array [
collect/componentA/componentA.js,
2,
],
Array [
collect/componentA/index.js,
1,
Expand All @@ -87,10 +101,17 @@ Object {
},
Hello World: Object {
comments: Array [],
extractedComments: Array [],
extractedComments: Array [
Comment A,
Hello comment,
],
flags: Array [],
obsolete: false,
origin: Array [
Array [
collect/componentA/componentA.js,
2,
],
Array [
collect/componentA/index.js,
1,
Expand Down Expand Up @@ -158,10 +179,17 @@ Object {
},
Hello World: Object {
comments: Array [],
extractedComments: Array [],
extractedComments: Array [
Comment A,
Hello comment,
],
flags: Array [],
obsolete: false,
origin: Array [
Array [
collect/componentA/componentA.js,
2,
],
Array [
collect/componentA/index.js,
1,
Expand Down Expand Up @@ -199,10 +227,17 @@ Object {
},
Hello World: Object {
comments: Array [],
extractedComments: Array [],
extractedComments: Array [
Comment A,
Hello comment,
],
flags: Array [],
obsolete: false,
origin: Array [
Array [
collect/componentA/componentA.js,
2,
],
Array [
collect/componentA/index.js,
1,
Expand Down Expand Up @@ -240,10 +275,17 @@ Object {
},
Hello World: Object {
comments: Array [],
extractedComments: Array [],
extractedComments: Array [
Comment A,
Hello comment,
],
flags: Array [],
obsolete: false,
origin: Array [
Array [
collect/componentA/componentA.js,
2,
],
Array [
collect/componentA/index.js,
1,
Expand Down Expand Up @@ -274,10 +316,17 @@ Object {
},
Hello World: Object {
comments: Array [],
extractedComments: Array [],
extractedComments: Array [
Comment A,
Hello comment,
],
flags: Array [],
obsolete: false,
origin: Array [
Array [
collect/componentA/componentA.js,
2,
],
Array [
collect/componentA/index.js,
1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/*i18n*/ i18n._("Component A")
/*i18n*/ i18n._("Component A");
/*i18n*/ i18n._("Hello World", {}, {comment: "Comment A"});
2 changes: 1 addition & 1 deletion packages/cli/src/api/fixtures/collect/componentA/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/*i18n*/ i18n._("Hello World")
/*i18n*/ i18n._("Hello World", {}, {comment: "Hello comment"})
6 changes: 1 addition & 5 deletions packages/cli/src/api/formats/po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ const deserialize: (item: Object) => Object = R.map(
R.applySpec({
translation: R.compose(R.head, R.defaultTo([]), getTranslations),
extractedComments: R.compose(R.defaultTo([]), getExtractedComments),
comments: (item) =>
R.concat(
getTranslatorComments(item) as string,
R.tail(getExtractedComments(item))
),
comments: R.compose(R.defaultTo([]), getTranslatorComments),
obsolete: isObsolete,
origin: R.compose(R.map(splitOrigin), R.defaultTo([]), getOrigins),
flags: getFlags,
Expand Down

0 comments on commit e336aff

Please sign in to comment.