-
Notifications
You must be signed in to change notification settings - Fork 6
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
Translation of feedback messages #4
Comments
All the work done so far was to make this tool as compatible as possible with the dropbox's one as possible. Their work did not include any translation, either. I have noticed other people with similar problems (like here: envato/zxcvbn-ruby#36) but I could not get any feedback from them. Just trying to avoid guessing the solution. I would be aiming for leaving the existing api shared with zxcvbn-ruby and zxcvbn-js untouched, meaning the IMHO, I think if just the translatable information (translation key and values) is returned, then the developer can easily integrate with their translation tool of choice. I can't remember from the top of my head but I believe there may be more files involved than just Of course PR's may be accepted. I will be glad to have any kind of help. 😄 |
@TwilightCoder I just noticed something that might be helpful: None of the feedback strings have interpolation, which makes their translation trivial. just The I believe that having a full list of string that will need translation documented anywhere will be the hardest part of this work in any way you decide to tackle it. |
This is the list with all strings I could find.
|
Yes, I realized this alternative approach later and was going with it. I did similarly extract those strings from We aren't using the |
Returning the keys here along with the value might be helpful for I18n syntax, but I don't see it making things any easier for gettext syntax. And even for the I18n syntax, I see a sample repo above that seems to handle it somewhat eloquently by converting sentences into keys by snake casing them (references: code | locale file). Thanks for the digging and writeup. |
I think gettext can work fine with keys similar to i18n, it is just not the convention (https://phrase.com/blog/posts/i18n-translate-ruby-applications-with-gettext-gem/#:~:text=Here%2C%20as%20you,New%20account%20instantiated!%22). Actually, after having a closer look on how gettext would manage these translations plus after seeing what that link you have posted above on how they managed to use i18n, I have a stronger feeling that this gem should not (or need not) try to tackle translations because it is not hard at all to pick any tool and adapt to do the job. Having that said, I think this discussion was really valid and its contents will still be useful. mainly the strings that would be translated: #4 (comment) I don't have a clear use-case to implement and help me to drive this atm but I would love to point to such work. |
Good to know, although that seems to negate most of the benefits of using gettext over i18n.
Yes, this is what I was implying as well.
Having a wiki entry (linked in the readme) seems sufficient for now. |
I agree and with the little time I had in hand today I could only make this: https://github.com/formigarafa/zxcvbn-rb/wiki/Translations Hopefully, soon I will extend it and link in the readme. Please, feel free to suggest changes and supply examples using gettext, I don't feel I am the best for this last one. |
added link on readme and also more explanations on the process. |
Looks good mostly. Regarding gettext:
Additionally (as noted above), it's worth mentioning that the source messages should be manually listed somewhere in a sync path, wrapped in a gettext method (ideally N_()) for it to be picked up during sync, for eg: # list of hardcoded source texts from the gem for the gettext parser
# N_("Straight rows of keys are easy to guess")
# N_("Short keyboard patterns are easy to guess")
# ...
translated_warning = _(zxcvbn_result.feedback['warning']) |
@TwilightCoder , if you don't mind I would really appreciate if you could add these details for me on the wiki and I believe you will do a better job than me. thanks. |
Should've mentioned this earlier, but - sorry, I don't have permission to edit the wiki page. |
ooooohhhh!!!! just found the setting that makes wiki publicly editable, @TwilightCoder . Please, have a go now. thanks. |
Done!
Although not sure how much of a desirable state this is. |
that's great the way it is and if for any reason someone find something to be improved the door is open for it and every help is welcome. |
No doubt. Although my concern was more about (the possibility of) unwanted edits. |
So far I don't believe any person will come to cause trouble. |
What is the standard approach for translating the feedback messages? Apart from forking and editing the source file
lib/zxcvbn/feedback.rb
.Also, are PR submissions accepted for this? We prefer the
gettext
syntax, althoughI18n
would work too (although a new gem dependency is apparently required in both cases).P.S. Thanks for this ruby port.
The text was updated successfully, but these errors were encountered: