Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

Commit

Permalink
Fix: node11 test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bacra committed Nov 13, 2018
1 parent bac1157 commit 5d0ece1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
25 changes: 20 additions & 5 deletions lib/create.js
Expand Up @@ -255,14 +255,28 @@ function json2pot(items, lan, options)

poInfo.items = _(items)
.values()
.sort(function(a, b)
{
return a.msgid > b.msgid ? 1 : -1;
})
.map(function(item)
{
return item.toPOItem();
})
.sort(function(a, b)
{
if (a.msgid == b.msgid)
{
if (a.msgstr == b.msgstr)
{
return a.references.length > b.references.length ? 1 : -1;
}
else
{
return a.msgstr > b.msgstr ? 1 : -1;
}
}
else
{
return a.msgid > b.msgid ? 1 : -1;
}
})
.value();

return poInfo.toString();
Expand All @@ -286,7 +300,8 @@ _.extend(TPOItem.prototype,
item.references = _.map(this.fileInfos, function(num, fileInfo)
{
return '@@'+fileInfo;
});
})
.sort();

if (item.references.length == 1 && item.references[0] == '@@0,*')
{
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "i18nc-po",
"version": "2.6.0",
"version": "2.6.1",
"description": "I18NC PO File utils",
"main": "index.js",
"scripts": {
Expand All @@ -24,7 +24,7 @@
"eslint": "^5.9.0",
"eslint-config-brcjs": "^0.2.0",
"expect.js": "^0.3.1",
"i18nc-core": "^10.11.0",
"i18nc-core": "^10.12.0",
"istanbul": "^0.4.5",
"mkdirp": "^0.5.1",
"mocha": "^5.2.0"
Expand Down
8 changes: 4 additions & 4 deletions test/files/output_create/existedTranslateFilter/keep/en-US.po
Expand Up @@ -35,13 +35,13 @@ msgstr ""
msgid "中文I18N subtype5%s中文I18N subtype6"
msgstr ""

#: @@2,8,subtype2,*
msgid "简体"
msgstr ""

msgid "简体"
msgstr "cn"

#: @@2,7,subtype,*
msgid "简体"
msgstr "zh"

#: @@2,8,subtype2,*
msgid "简体"
msgstr ""
6 changes: 3 additions & 3 deletions test/files/output_create/existedTranslateFilter/keep/zh-TW.po
Expand Up @@ -35,10 +35,10 @@ msgstr ""
msgid "中文I18N subtype5%s中文I18N subtype6"
msgstr ""

msgid "简体"
msgstr "簡體"

#: @@2,7,subtype,*
#: @@2,8,subtype2,*
msgid "简体"
msgstr ""

msgid "简体"
msgstr "簡體"

0 comments on commit 5d0ece1

Please sign in to comment.