Skip to content

Commit

Permalink
feat(@formatjs/cli): extract object-type description from message, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
longlho committed Jan 20, 2022
1 parent 3f75923 commit d463673
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/cli/src/formatters/crowdin.ts
Expand Up @@ -13,7 +13,10 @@ export const format: FormatFn<SmartlingJson> = msgs => {
for (const [id, msg] of Object.entries(msgs)) {
results[id] = {
message: msg.defaultMessage!,
description: msg.description,
description:
typeof msg.description === 'string'
? msg.description
: JSON.stringify(msg.description),
}
}
return results
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/formatters/lokalise.ts
Expand Up @@ -15,7 +15,10 @@ export const format: FormatFn<StructuredJson> = msgs => {
for (const [id, msg] of Object.entries(msgs)) {
results[id] = {
translation: msg.defaultMessage!,
notes: msg.description,
notes:
typeof msg.description === 'string'
? msg.description
: JSON.stringify(msg.description),
}
}
return results
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/formatters/smartling.ts
Expand Up @@ -41,7 +41,10 @@ export const format: FormatFn<SmartlingJson> = msgs => {
for (const [id, msg] of Object.entries(msgs)) {
results[id] = {
message: msg.defaultMessage!,
description: msg.description,
description:
typeof msg.description === 'string'
? msg.description
: JSON.stringify(msg.description),
}
}
return results
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/formatters/transifex.ts
Expand Up @@ -15,7 +15,10 @@ export const format: FormatFn<StructuredJson> = msgs => {
for (const [id, msg] of Object.entries(msgs)) {
results[id] = {
string: msg.defaultMessage!,
developer_comment: msg.description,
developer_comment:
typeof msg.description === 'string'
? msg.description
: JSON.stringify(msg.description),
}
}
return results
Expand Down

0 comments on commit d463673

Please sign in to comment.