carlalexander / passwords-evolved

WordPress password authentication for the modern era
https://wordpress.org/plugins/passwords-evolved/
GNU General Public License v3.0
100 stars 10 forks source link

Improve Internationalization #2

Closed 2aces closed 6 years ago

2aces commented 6 years ago

Just an early Issue to track my collaboration for improving internationalization.

cliffordp commented 6 years ago

For your 2nd bullet: Since this plugin is hosted on WordPress.org, they will provide the actual translations if everything is setup properly within the plugin itself.

carlalexander commented 6 years ago

Yeah, @brianhogg explains it here. The WordPress.org translations are for creating a language pack for WordPress. If want to include the translations in the plugin itself, we need to add the translations here in the repo.

2aces commented 6 years ago

@cliffordp @carlalexander for point 2: I already translated there (user celsobessa). Thanks.

The first bullet point, though, is giving me some trouble.

I understand the translate code and the idea behind it but I can't use tools like PO Edit to automatically find all translatable strings (and I added some new ones in my local version). And it is way better to work with than with translate.wordpress.org.

Whenever I use Update from Source Source, it makes string obsoletes and and get rid of them. Not sure if is a POedit problem or if I am messing something up.

Screenshots attached:

passwords-evolve-poedit-2 passwords-evolve-poedit-3 passwords-evolve-poedit-4 passwords-evolve-poedit-5 passwords-evolve-poedit-6 passwords-evolve-poedit-7

carlalexander commented 6 years ago

So using PO edit to detect the translatable strings won't work due to how I handle translations. It's searching for standard WordPress functions and there aren't really any. Instead, to translate the plugin, you have to select "Create New Translation" and use the .pot file in /resources/translations.

EDIT: Sorry, I didn't see that's what you did. The only thing is that you can't do "Update from source code". That won't work and will break everything. The .pot file is always the one with all the translation strings. (Even English is a translation so the .pot will always have all the translations or it's a bug.)

So to summarize, I think you were doing everything correctly up to "Update from source code". You can either copy passwords-evolved-en_US.po, change the language/file name and translate the strings. Or you can do "Create New Translation" and use the .pot file in /resources/translations.

2aces commented 6 years ago

Excuse me if I sound like a noob, but there are some strings which should be translatable, like a "Dismiss this notice" in page.php, line 6. If I understood everything correctly, I should:

  1. Change the text to <?php $this->translate('dismiss_notice'); ?>
  2. add msgid "admin_page.dismiss_notice" and msgstr "" to the POT file
  3. add msgid "admin_page.dismiss_notice" and msgstr "" to the en_US.po file and add "Dismiss this notice" translation
  4. add msgid "admin_page.dismiss_notice" and msgstr "" to the pt_BR.po file and add "Remover aviso" translation

Is that right?

carlalexander commented 6 years ago

Yup! Also there's no noob questions! 😄

2aces commented 6 years ago

I am curious. How does that work with glotpress in the official repository? Seems to me translate.wordpress.org will not show those strings properly. Right now, there are only 5 translatable strings in there, but the POT file have way more.

carlalexander commented 6 years ago

I didn't design this with glotpress in mind initially. I can look to see if I can tell it where the .pot file is. It should be able to detect that.

2aces commented 6 years ago

@carlalexander I didn't (and do not) mean to tell you how you should design your plugin or what it should be. I am just concerned that the way the plugin is today makes harder to get it translated and used by the international community. For example, if future updates bring new strings they won't be added to translate.wordpress.org automatically, and .po files will be "out of sync" (some translators will the new string and add it to it's locale .po file, others won't), etc.

For example:

In April 7th I will host a meetup in a small town in Brazil country side (Tiradentes) and security is one the topics of my talk. I was thinking about suggesting your plugin. I know a lot of WP users in Brazil can read english, but most, probably not.

It won't be a problem for people attending meetup, because i will be using my translated install, but people elsewhere won't and I am not sure how I can share my pt_BR today. Should I commit it and open a PR and will be distributed with the plugin itself? Should I upload it to translate.wordpress.org ? None of the above?

What do you think is the best course of action and what can I do to contribute?

carlalexander commented 6 years ago

Should I commit it and open a PR and will be distributed with the plugin itself?

I would prefer that. I think that I need to fix it so that translate.wordpress.org can pick it up as well. But, for now, I'd rather have the translations here.

carlalexander commented 6 years ago

Just did this commit which should fix the issue. Will push it to the directory later.

carlalexander commented 6 years ago

Just released the 1.1.2 version with your translation. Thanks!