Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how update --sortByMsgid works #101

Open
dimaqq opened this issue Jul 17, 2020 · 4 comments
Open

Document how update --sortByMsgid works #101

dimaqq opened this issue Jul 17, 2020 · 4 comments

Comments

@dimaqq
Copy link
Contributor

dimaqq commented Jul 17, 2020

I'd love to see --sortByMsgid documented better: that turning this option on after .po files are already created will keep the original sort order of the old entries and sort the new entries according to message id.

Old

yarn tells me it ran path-to/node_modules/.bin/ttag update --extract-location=never --sortByMsgid int/ja-JP.po src

My .po file looks like this:

msgid "Loading..."
msgstr "ローディング..."

msgid "Batch Operations"
msgstr "バッチ操作"

msgid "Users"
msgstr "ユーザー一覧"

It doesn't appear sorted to me...

@dimaqq
Copy link
Contributor Author

dimaqq commented Jul 17, 2020

I think I know what's going on... maybe...

If a .po files was originally created without sort; then sort was turned on and only a few translatable strings were changed/added/removed then only these "new" translatable strings are sorted alphabetically, while the rest of .po files remains as is.

Maybe that's OK 🤔

@tlw44f
Copy link

tlw44f commented Jul 30, 2020

I set up my local to have these scripts that will copy the existing po file, generate a new one, and then merge them back in together. Its not perfect but it does keep it organized.

"ttag:regenerate": "mv src/i18n/fr.po src/i18n/fr.old.po && npm run ttag:newPo && npm run ttag:update && mv src/i18n/fr.po src/i18n/fr.new.po && npm run ttag:merge && npm run ttag:update && rm src/i18n/fr.old.po && rm src/i18n/fr.new.po",
"ttag:newPo": "ttag init fr src/i18n/fr.po",
"ttag:merge": "ttag merge src/i18n/fr.new.po src/i18n/fr.old.po > src/i18n/fr.po",
"ttag:update": "ttag update src/i18n/fr.po src/ --numberedExpressions=true --sortByMsgid=true --extractLocation=file",

@dimaqq dimaqq changed the title Does update --sortByMsgid work? Document how update --sortByMsgid works Jul 31, 2020
@dimaqq
Copy link
Contributor Author

dimaqq commented Jul 31, 2020

I guess it's enough to document the behaviour.

@mkosir
Copy link

mkosir commented Aug 11, 2020

Came across the same issue as @dimaqq , I think --sortByMsgid should sort also existing translations and newly inserted ones. Noticed that insertion of new translations works for extraction to .pot files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants