-
Notifications
You must be signed in to change notification settings - Fork 8
Extract localization ressources ? #30
Comments
Rails use YAML file format to manage I18n (https://github.com/agile-france/propile/tree/master/config/locales). File name is not important for I18n process, we can use what we want for our organisation. Inside file, their indetation key, that help for context. To translate a key, just copy the context under a fr: top key. Here is an example: en: date: formats: default: "%m/%d/%y" (... other keys ...) fr: date: formats: default: "%d/%m/%y" (... other keys ...) Hope it's help. After, there is some scripts and tools that take those YAML files and do some stuff with, but I don't know lot of them. |
But there is no tools to extract char for page. Or I don't know them. It's perhaps an idea to build. But more of the rails dev work directly with i18n keys :-) |
Hello, the basic helper for translations is # config/locales/layouts.fr.yml
fr:
layouts:
main_menu:
log_in: 'Connexion' You can use it that way in your view :
Additionally, there are helpers for the current view. If you're in a
And have this yaml file : # config/locales/contacts/new.fr.yml
fr:
contacts:
new:
email: 'Adresse mail' The fact that rails should use |
There are also a few configuration you may want to change in
All this config are already there (albeit commented for some) in The very last config is only needed if you want to use subdirectories Edit : Also, please note something somewhat tricky at first in |
Oh, btw. This also works in rails :) You can have But since this app won't support dual language (afaik), there's no |
Hi, With the team, we are agree to work to start I18N migration.
I can help on that if needed. |
I have begun translating the pages into french but that seems a bit silly. I'm a total newbee to RoR but there must be a way that we extract ressources or somehow implement a localization mechanism so that the app becomes multilingual.
I'm a .NET guy. In dotnet we would basically have two options : either use a I18N extension that extract ext litterals at build time into gettext dictionnaries or hack the view rendering engine so that it uses the view based on the local : index.html (generic) index.fr.html (french neutral) index.fr-CA.html (canadian french locale)
I'm pretty sure RoR has plenty of options like this. Anyone willing to address this ?
The text was updated successfully, but these errors were encountered: