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
Remove line numbers from manageiq.pot and manageiq.po #22217
Conversation
9fcb7f7
to
c89715b
Compare
This may not be the right place, but I think it's good for a first pass and we can optimize the location later possibly. One oddity I noticed is that sometimes there are multiple references on the same line and I don't understand why (see example below). I think it's possibly an option to gettext for consolidating reference lines, but not sure where. For now, I only stripped the end, which, again, I think is fine for a first pass. -#: ../app/controllers/vm_common.rb:628 ../app/controllers/vm_common.rb:630
+#: ../app/controllers/vm_common.rb:628 ../app/controllers/vm_common.rb
msgid " (Analysis History)"
msgstr "" |
@Frank-NB Can you review this and make sure this wouldn't be a problem for you? See the examples above where the filenames would still be in the english po/pot but the line numbers would be removed. |
lib/tasks/locale.rake
Outdated
|
||
# Fix duplicate subsequent lines where there were multiple references in the same file | ||
path.write( | ||
(path.readlines << nil).each_cons(2).map { |l1, l2| l1 == l2 ? nil : l1 }.compact.join |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this looking at the msgid/msgstr lines too? Should we only look at consecutive duplicate #
comment lines or more specifically ones with paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes good point. This looks at any duplicated subsequent lines. I'd be surprised if any non-comment lines were identical, but I should probably be more tactical here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrafanie Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I took your word "consecutive" - I knew there was a better word 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, naming is hard 🤣
1539633
to
b71ea52
Compare
b71ea52
to
a948118
Compare
Some comments on commits Fryguy/manageiq@a689283~...a948118 lib/tasks/locale.rake
|
Checked commits Fryguy/manageiq@a689283~...a948118 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
@Frank-NB what I'm asking is does this cause any problems with the translation tools you're using. See the attached update po/pot. If we change this, we want to make sure your tools will not have problems with the commented files+line number locations. |
Hi @jrafanie , I think it is ok for translation tool, we use msgid as key, and msgstr as value. |
@@ -207,6 +221,9 @@ namespace :locale do | |||
system('rmsgmerge', '--sort-by-msgid', '--no-fuzzy-matching', '-o', Rails.root.join('locale', 'en', 'manageiq-all.po').to_s, Rails.root.join('locale', 'en', 'manageiq.po').to_s, Rails.root.join('locale', 'manageiq.pot').to_s) | |||
system('mv', '-v', Rails.root.join('locale', 'en', 'manageiq-all.po').to_s, Rails.root.join('locale', 'en', 'manageiq.po').to_s) | |||
system('rm', '-rf', tmp_dir) | |||
|
|||
remove_line_numbers(Rails.root.join('locale/manageiq.pot')) | |||
remove_line_numbers(Rails.root.join('locale/en/manageiq.po')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should also remove the lines numbers in the translations:
locale/pt_BR/manageiq.po
locale/ja/manageiq.po
locale/it/manageiq.po
locale/zh_TW/manageiq.po
locale/zh_CN/manageiq.po
locale/de/manageiq.po
locale/ko/manageiq.po
locale/fr/manageiq.po
locale/es/manageiq.po
In addition to what it's already doing:
locale/en/manageiq.po
locale/manageiq.pot
Then the translators add or remove from the translations and these translations come back without line numbers.
Is this doable? Is this a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do want to get this in as I think removing line numbers will help see the actual changes to all of these files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Frank-NB Can you verify if it's ok for us to remove line numbers in the translations too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can definitely do that but it should happen automatically. That is, I'd expect the translators to take the .pot files and generate the .po from it, so those line numbers are driven by the .pot. (Though we can do a first pass for diff purposes manually of course, but it doesn't have to be this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, I'd like @Frank-NB's opinion as I'm unsure how they create/update the translation files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jrafanie , Yes, we take the .pot files and generate tho .po from it, so I think if you update en/manageiq.po and manageiq.pot, translations will come back without line numbers. but I think we need to test it after this PR merged, hope it can work as design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering they are only comments, this should not affect anything from working. We had considered removing the comments entirely, but I think having at least the files is useful diagnostically.
cc @jtux270 |
Ok, I'm merging this @Frank-NB... the next round of po/pot will be missing line numbers so please let us know if you run into problems with it. |
Backported to
|
Resolves #21943
@jrafanie Please review.
Example of one of the more thorough changes: