-
Notifications
You must be signed in to change notification settings - Fork 110
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
Comments
Comment by johnclause
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. |
Comment by pedro-mendonca
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. |
Comment by johnclause 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? |
Comment by pedro-mendonca 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. |
Comment by johnclause I added this comment and filtered this string in .pot in the script. I guess that is the optimum? |
Comment by pedro-mendonca 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. |
Comment by johnclause '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? |
Comment by pedro-mendonca 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. |
Comment by pedro-mendonca 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. |
Comment by pedro-mendonca I've read somewhere that the TRANSLATORS: was some kind of default setting, but it's probably customizable to anything you would prefer. |
Comment by pedro-mendonca 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. |
Comment by johnclause 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. |
Comment by pedro-mendonca 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. |
Comment by pedro-mendonca 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. |
Comment by johnclause
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? |
Comment by pedro-mendonca
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 :) |
Comment by pedro-mendonca
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. |
Comment by johnclause
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. 👍 👍 |
Comment by pedro-mendonca This is particularly good to translate native WordPress labels like menus, options etc. 👍 |
Issue by pedro-mendonca
Thursday Mar 26, 2015 at 09:33 GMT
Originally opened as qTranslate-Team/qtranslate-x#100
pedro-mendonca included the following code: https://github.com/qTranslate-Team/qtranslate-x/pull/100/commits
The text was updated successfully, but these errors were encountered: