L20n/Features/Variable watching

From MozillaWiki
< L20n‎ | Features
Jump to: navigation, search


goal

Watch for changes of value of context variables and globals and update the localization automatically when the changes occur.

example

   <timeOfDay() { @hour <= 12 ? "morning" : @hour <= 18 ? "afternoon" : "evening" }>                      
                                                                                                          
   <greeting[timeOfDay()] {                                                                               
     morning: "Good morning, {{ $user.firstname }}!",                                               
     afternoon: "Good afternoon, {{ $user.firstname }}!",                                           
     evening: "Good evening, {{ $user.firstname }}!"                                                
   }>


When the value of @hour changes, we should be able to automatically update the translation. We'd need some kind of a watcher/observer pattern in l20n.

Might want to look into JavaScript's watch (non-standard, not recommended) or the corresponding polyfill.

status

not in 1.0