dimanche 21 juillet 2019

Mobility Gem translation, Take "en" default from stored json in database

i have used a mobility gem for translation and in database i am storing json like { "de": "Abc", "en": "Abc", "fr": "Abc" } so when i am passing "de" language to params then it is giving the Abc translated for de language but i wanna do that if language passed from params is not exist in above json then it should take "en" as default , so what can i do for that?

in model i have used below code:

  include LocaleExtension
  extend Mobility
  translates :restaurant_name, type: :string
  # and  i have stored above json in restaurant_name field in database.

Aucun commentaire:

Enregistrer un commentaire