I have a Rails 3 app in which I'm using I18n.available_locales to display a list of available languages for user accounts. In my config/locales directory I only have en and nl yml files, however, I18n.available_locales returns a variety of other locale keys which I'm assuming are present due to translations being present in the gems that I'm using. Is there a common/standard way to get the method to only return the translations present in the app itself?
I would suggest, you use this gem : rails-i18n , it provides basic translations for every languages, and then, restrict available locales with
config.i18n.available_locales = ['es-CO', :de]
Of course, rails-i18n is not mandatory here, you could simply define available_locales
in your config/application.rb
file
And as said in the comments, you should definitely accept some answers to improve your accept_rate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With