-
Notifications
You must be signed in to change notification settings - Fork 56
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
Internationalization support #105
Comments
Hi @pablofullana. Thanks for checking out Goby and opening this issue. This sounds like a promising feature, although I can't say that I have any immediate ideas about the implementation. I think our "top-level object" would be If we did implement this feature, I would want it to be completely optional from the end-user's point of view (changing the load path, choosing language, etc.). Also, we have many strings that are "somewhat" hardcoded - meaning a long string of text with maybe one or two arguments: def HI(name)
"Hi #{name}!"
end Do you know if we could use i18n for these kinds of strings? I am opening the branch |
Great hearing back from you and I'm glad you are interested in this feature! First, regarding message customization. Developers would be able to define their own translation by simply adding the following line to their application:
Or wherever their translation files will be placed at. And then just overwriting any message inside those files. Secondly, regarding language selection. Just by creating a new translation file and setting the translation messages accordingly, the developer would simply have to add the following line to his application:
As long as there is a Finally, regarding the arguments for translations. I18n supports, out of the box, variables. Simply like this:
And having defined something in the fashion of:
More documentation at: http://guides.rubyonrails.org/i18n.html#passing-variables-to-translations If you are with the above stated behavior, I could submit you a PR with the basic configuration for i18n support and a some documentation that could be added to the wiki to describe how developers could customize messages. |
All of that sounds good, and I would be happy to review the PR and documentation. Could you explain again what you need the "top-level object" for? Reading your explanation, I don't have a good idea about what its purpose would be. |
If you need Dutch translations, let me know |
Hello there. I was taking a look at this repository (not sure how I got here...) and it looks quite interesting. Something I found while checking the code out is that there are several messages hardcoded inside the classes. So I thought it would be quite useful to have i18n in place.
I started to add i18n, added the gem as a dependency, required it in
goby.rb
and put a very basiclocales/en.yml
in place. Even everything seems to be working just fine, I got a concern/question. I was thinking on a user trying to change this default messages (located atlocales/en.yml
) and had a hard time trying to figure it out. I thought that a good approach may be to have some sort of configuration in a top level object representing the game itself. Do you think this is a good approach? If so, is there any object (Game, Goby, w/e) in which general settings are being stored? It guess that it would be nice, as a developer using Goby, to be able to do something in the fashion of:Goby.config.i18n_load_path = ...
So far, what I have coded can be found at: https://github.com/pablofullana/goby/tree/add-i18n-support
Your thoughts.
The text was updated successfully, but these errors were encountered: