rubenv/grunt-angular-gettext

Keep the order of the extracted strings

RopoMen opened this issue · 6 comments

HI,

I'm not 100% sure that if this is the right repo for this question/issue, but anyways.
When strings are extracted in to '.pot' file how the order is maintained?

Currently I have noticed that out '.pot' file looks VERY messy and git diff shows a lot of removed and added strings even if there would be only one added and one removed translation.

My Gruntfile source config looks like this (which is given to extract task)

nggettextall_sources: [
    'public/common/js/**/*.html',
    'custom/contentEditor/**/*.html'
]

Our developers uses Windows, Mac and Linux machines and I was starting to think about if the reason is how different OS's return those files from those folders, because nothing guarantee the order of the files.
Could the order of translations to be improved?

Br,
Markku Roponen

We do sorting on keys, then contexts: https://github.com/rubenv/angular-gettext-tools/blob/0bf100459fdd8f4aac4b6aa76103c853a0f2a50d/lib/extract.js#L390-L400

Different file enumeration orders shouldn't make a difference.

Hi,

Now I know what is going on here =)

Case SENSITIVE and INSENSITIVE comparison below is some example set where another one is build in Windows and another in Linux.

/* Example file build in Windows (almost 100% sure of that, but if needed I can verify this) */

#: public/common/js/templates/navigation.html:4
msgid "[[ selected.name ]]"
msgstr ""

#: public/common/js/app.js:165
msgid "404 - File not found!"
msgstr ""

#: public/common/js/contents/Dashboard.js:21
#: public/common/js/contents/templates/dashboard-analyze.html:4
msgid "Analyze"
msgstr ""

#: public/common/js/language/LanguageFactory.js:80
msgid "april"
msgstr ""

#: public/common/js/language/LanguageFactory.js:78
msgid "february"
msgstr ""

#: public/common/js/editor/templates/settings.html:41
#: public/common/js/pages/templates/page-settings.html:4
msgid "Settings"
msgstr ""

/* Same example file build in Linux Ubuntu 14.04 */

#: public/common/js/app.js:165
msgid "404 - File not found!"
msgstr ""

#: public/common/js/contents/Dashboard.js:21
#: public/common/js/contents/templates/dashboard-analyze.html:4
msgid "Analyze"
msgstr ""

#: public/common/js/editor/templates/settings.html:41
#: public/common/js/pages/templates/page-settings.html:4
msgid "Settings"
msgstr ""

#: public/common/js/templates/navigation.html:4
msgid "[[ selected.name ]]"
msgstr ""

#: public/common/js/language/LanguageFactory.js:80
msgid "april"
msgstr ""

#: public/common/js/language/LanguageFactory.js:78
msgid "february"
msgstr ""

Most likely locale settings differ in different developer machines and because that sort is using JS localeCompare results may be different.

I've switched to a locale-independent sorting: rubenv/angular-gettext-tools@76655bb

Fix released as v2.2.3.

Thanks for reporting this!

Thank you!

Now Windows and Linux makes identical .pot file.