-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
internationalized body of mailers #1989
Conversation
I actually guessed so, but did not notice, and just felt like "oh, some translations are missing". How about adding more emphasized guidance from the master wiki toward the devise-i18n project?
For "those not using i18n", this part would be outside their head or interests, although for those using i18n, missing translations (OR missing "the existence of" translations) practically assigns them a lot of additional works. |
Hi @orzccc Thank you so much for your pull request. As we're receiving a lot of pull requests about it recently, I think it is time, as you suggested, to emphasize guidance on this matter. As you may have noticed, Devise views are only a way to quickly have a working authentication system, and as they are almost always overwritten with a custom view, adding it will only increase complexity on an environment that (at least initially) should be simple. |
@orzccc feel free to update the wiki pages to provide the guidance you feel that it is missing. they are public and everyone has access to edit them! tks! |
@orzccc Internationalizing that views/mailers does not requires a giant amount of work and thus there are couple of attempts spread all over forums and groups. So can I suggest that we could create a new gem right now, call it something like 'devise-intenationalized-views' and merge I18n views with @orzccc mailers. Then if @josevalim, @rodrigoflores ... agree we could create/use a wiki page to provide guidance on how to actual translate views. What about that? |
This sounds perfect. Having a solid |
Ok done: https://github.com/mcasimir/devise-i18n-views gem "devise-i18n-views" I've basically downloaded @orzccc version of mailers (with a fallback to English) and merged it with devise views translated in a crude way, such that the string "Sign In!" in file "views/devise/sessions/new.html.erb" is now <%= t("devise.sessions.new.sign_in", :default => "Sign In!") %> It can be done better but it is a good starting point. Maybe someone can help me to test it and discuss a little convention for I18n keys before publicly add it to the wiki. I don't know if this is the right place to talk about it, perhaps it would be better to move somewhere else, am I right? but where then? |
I don't mind with continuing the discussion here. I would suggest to use the view shortcut for the translations though:
It is how it is commonly used in Rails apps and it is shorter. The only difference is that the key will now be By default, Rails and I18n loads all translations in the config/locales/*. This means that, if you put all translations inside the gem, in the future you may have 20+ different translations and they will all be loaded into your app. This could possibly take MBs of memory. So I would suggest to put all translations into a translations directory at root and tell people to manually copy it to their apps. Since you are already adding the default to the views, you don't need to have anything in config/locales and it should work fine. About testing, the best recommendation I can give is to grab latest Rails and run:
It will generate a full application inside test. In this application, you should install Devise, as you would for any app, and then you can test it as you would in any app. Simple assertions on the contents should do the trick. |
Thanks for your suggestions, there is always something new to learn! Based on what you told me i've changed it as follows:
Nothing except basic translation is tested yet, tomorrow i could try to see what happens with the mailer but at this time i don't have so much time to write programmatic tests, i hope someone else could do that if it's necessary. Also, i've never mantained a Gem before now, neither a small one, so i've no idea about how much time it takes, is it a busy task? |
Since it is a small gem, it shouldn't take much of your time. About the generators, I would suggest you to simply name it:
It will be shorter and easier. :) |
What about |
Sure, thats also great. Sent from my iPhone |
Ok renamed and tested the mailer also, now it seems ok to me. |
added translation capability to body of mails sent for the instructions.
(error messages are pretty much translated although html views (hn or buttons) and mails body have not yet)