-
Notifications
You must be signed in to change notification settings - Fork 149
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
Added texdomain and portuguese files update #100
Conversation
Added texdomain and portuguese files update - thanks!
@@ -1392,7 +1392,7 @@ function qtranxf_conf() { | |||
</fieldset><br /> | |||
<textarea id="highlight_mode_custom_css" name="highlight_mode_custom_css" style="width:100%"><?php echo esc_attr($highlight_mode_custom_css); ?></textarea> | |||
<br /> | |||
<small><?php echo __('To reset to default, clear the text.', 'qtranslate').' '; printf(__('The color in use is taken from your profile option %s, the third color.', 'qtranslate'), '"<a href="'.admin_url('/profile.php').'">'.__('Admin Color Scheme').'</a>"') ?></small> | |||
<small><?php echo __('To reset to default, clear the text.', 'qtranslate').' '; printf(__('The color in use is taken from your profile option %s, the third color.', 'qtranslate'), '"<a href="'.admin_url('/profile.php').'">'.__('Admin Color Scheme', 'qtranslate').'</a>"') ?></small> |
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.
This one was intentional. It is translated by WordPress, since it is a string from the main installation. It goes to .pot file anyway, it does not hurt to have it there translated, but if there is no .po file for a language, it will be translated anyway from WordPress, if domain is not specified. In this case, it is important to keep translation the same as in WP, since otherwise a person may not recognize, which option is meant.
I know, we discussed a few similar cases, and I am not sure every time. It seems to me that it is better to have at least a few strings translated in the absence of .po, than nothing. It does not really make a difference to translator, since it gets to .pot file in any case. What do you think?
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 saw that this was already on the main WordPress .po because it's a link that appeared translated within a sentence not translated. So, I've found it's origin and translated it like it is in the main .po.
Yes, I think that the .po must be 100%, of course if you use a lot of strings similar to main WordPress localization files qTranslate will appear at leas somehow translated, but in the end that is not what's intended.
In the end I think it's not worthy to you to try to use strings already translated in the main WordPress, to brain expensive :)
With or without textdomain, if a specific localization don't exist, qTranslate will get it from the main files, so there is no difference, please always include it.
Translators should of course make their work perfectly according to WordPress terms, rules and guidelines.
This reminds me of the Translation Guide that we've not completed yet :)
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.
As I said above, I've spotted that already existing translation because I was lucky.
I suggest that if you want to use a specific title of something already existing, like this Admin Color Scheme, maybe you can add a comment to it, strings like Plugin titles, trademarks or author names can sometimes be confused with strings to translate. In this particular case a comment to explain it's context is the best way to inform translators what to do with that particular string.
I would not expect all translators to be that creative 👍 This really needs to be on the guide.
Are you sure about this? I think I tried something like this once and it was not translated, if domain specified, and it was translated, when domain is not specified, but now I am not sure. |
That is already on the first part I've written in the Guide https://github.com/qTranslate-Team/qtranslate-x/wiki/Tips-for-Good-Translations#table-of-contents
I've just checked this. |
So, if it is present in the .po file, and text domain is not specified, then translation stays unused, but does not hurt anything. We waste a bit of translator's time this way, but nothing gets broken, and one can potentially have benefit of seeing this string translated without .po file. This is especially beneficial in this case, since user knows how this option looks in WP, and there are no surprises. Otherwise, a user may not understand which option is meant. Translators may never find out that such a string will never be used, and their time is wasted. But in the alternative way, they still need to translate it (same time is spent), then they need to make an effort to be sure that they translated it the same way as in WP (much more time needed). From this, it seems to me that wasting a little bit of translator's time is the least evil, which outweighed by the benefits mentioned and by not asking the translator to find a matching string in WP. Besides, what if WP changes it? Unlikely, but possible. Then translator would need to do the search again. How translator would know when he needs to search again? It is getting more and more complex this way. It seems to me that letting translator to wastefully translate such a string is not that big of a deal, since this is rather rare and unusual case. I could also potentially filter those few special strings in the script in order to erase them from .pot file on each update. What do you think? |
Well I'm a bit skeptic because of it's reduncancy, but as you've mentioned the translator is doing a redundant work. To end this, I think that it won't harm to comment the string in the code, just in case some one catch it in Poedit in any case or if someone will try to add the textdomain again in the future. To comments get parsed, it should be used the TRANSLATORS: start and the comment must be on the line above the string, the syntax is like this below: qtx_configuration.php
Comments catched in Poedit contain important contextual info on the string, like this: qtranslate.pot
Whatever you choose, this kind of exceptional string deserve a comment like this to avoid further questioning. |
I added this comment and filtered this string in .pot in the script. I guess that is the optimum? |
As you've readded this string, it would be nice to flag that string also in .pot/.po files as I described above a not only in source php file. |
'TRANSLATORS:' comment is apparently a feature of poedit only, xgettext ignores it. I did not quite get why it would be good to have them commented in pot/po files? How does poedit show commented strings? pot and po currently do not have such strings at all and translator would not need to worry about it. If one spots it in a source file, then comment helps to understand to ignore it. Why do we still want to put it in pot file commented? Would not it create a potential confusion? |
Comments is a native feature in Poedit and it puts a sign on each particular commented string so that the translator can read it easily. Poedit uses this because it's a native feature of .pot files (gettext) I think weather the .pot generator includes comments or not while parsing the source code is just a matter of settings. |
While I don't know how to operate with gettext scripting, I believe this is what it looks like: This might be the option you need. |
I've read somewhere that the TRANSLATORS: was some kind of default setting, but it's probably customizable to anything you would prefer. |
Commented strings is a lot used, specifically in these cases of contextual help, where de developer gives some guidelines of the path to folow or the context. The strings get marked as commented and when clicked a comment window is shown with the text parsed from the source code comment. If you want I can make a screenshot of Poedit to explain this a bit better and eventually show you other softwares that make use of this usefull feature. |
Wow, thank you 👍 I was using 'man xgettext', searched for word 'TRANSLATORS' and got nothing. I will enable '--add-comments' it in the call to xgettext. But anyway, why do we need to put in pot file a string that does not need to be translated? I can easily enough put in pot and then comment it out with an additional action, and then it will not get propagated to .po anyway, is that right? I currently do not have a cycle to modify all .po files, they go native defined by pot. |
The string will be caught by any parser, xgettext or Poedit, and someone in the future might find it. If .pot/.po is generated by gettext you can control it to not include that particular string. |
You can now choose to exclude ir or not, but It's better to consider that if the workflow changes, you wouldn't have to think on this subject anymore as you've already prepared the .pot for the case of .po don't have any exclusions. I think this is already long enough and you've already understood the purpose of comments for future needs. I've been explained this for this string just for dev/translators workflow optimization. |
I remove it with an additional scripted editing from pot file. If you find an option in xgettext to ignore a specific, let me know. If somebody parses the sources on their own and find this string, then 'TRANSLATORS:' comment in the source will tell them why it is not included in pot file at first place. Why this is not good enough? Actually, I can use my own custom alias instead of '_e' in that place and no parser will find it. Is that better? |
Just because without comment on the .pot there won't be any mark on that specific string and I'm pretty sure that a translator only check source code in case of having a doubt, and if he knows how to do it. Having the comment on the source code and not having it parsed to .pot is like making a delecious cake and forget to eat it :) |
Yes, you can use another custom alias, but to garantee that no one will ever find it you will need to hide it in a custom not listed in gettext keyword. Is that possible? Won't it generate a php error? I'm not saying it will, I really don't have a clue without testing. I think that creating a well protected exception like is taking a lot of energy maybe because it's not to natural to the usual worklow. I'm sorry of beeing the devil's advocate I really don't want you to put unnecessary effort on this. I'm just trying to help by looking at all possibilities and their consequences. |
No, it is very simple, and the more I think about it, the more I like it. This is perfect, and I can use it for all other strings that are already translated in WordPress. This is the best solution, that I have seen so far for this problem. I really appreciate your discussion, which resulted in this 👍. I already added function 'qtranxf_translate_wp' for that purpose, and I can now cancel my custom piece in the script. All became as simple as possible. 👍 👍 |
This is particularly good to translate native WordPress labels like menus, options etc. 👍 |
No description provided.