timeago.dart
timeago.dart copied to clipboard
FR: Load language modules dynamically
I'm using a localization framework that can give me a list of available locals. So instead of manually writing up lots of these:
timeago.setLocaleMessages('ru', timeago.RuMessages());
I'm hoping to be able to do:
timeago.setLocaleMessages(['ru', 'sv', 'no']);
This would allow for adding translations in my source system without forcing additional manual code changes.
Since dart/flutter doesn't support eval o reflection this is not something I can solve client-side.
I second this. I think the messages param should be optional in case we want to override the messages. Otherwise it should be enough to load the locales using the first parameter.
Agree. This feature would be very helpful.
Even something like
timeago.setLocaleMessages('ru', timeago.getMessages('ru'));
would be helpful so that the library does the mapping instead of having to do it in the code using it.