-
Notifications
You must be signed in to change notification settings - Fork 97
Description
Context
I am in need of a way to dynamically set the fallbacks based on each instance/record. I currently have a default fallback establish for I18n which is fine, however I need some records to have another locale as default leaving the I18n empty or nil, it works fine, for example say my default fallback locale is en and I try to do something like translates :title, fallbacks: { en: :nl } this works as expected, I can leave the en title empty if I have nl. However, it won't always be nl this can be other languages and here is where my problem is because each record has a field called default_locale which I need want to pull from in order to declare the fallback for en I tried looking but cannot find a way to do this.
Expected Behavior
Ideally the instance object and attributes would be available to me or have ways to dynamically set fallbacks for the attributes. like:
translate :title, fallbacks: -> { en: my_dynamic_attribute_from_current_model }Actual Behavior
There is no scope to the current instance that would allow me to declare a fallback based on the models attribute. I also have not found any other method that allows this.
Possible Fix
Having a way to scope and access the attributes of an instance inside fallbacks or a way to declare dynamic fallbacks on locales for each instance.