timeago.dart icon indicating copy to clipboard operation
timeago.dart copied to clipboard

FR: Load language modules dynamically

Open marcjoha opened this issue 3 years ago • 2 comments

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.

marcjoha avatar Jul 21 '21 07:07 marcjoha

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.

minhdanh avatar Nov 27 '22 07:11 minhdanh

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.

petcupaula avatar Jan 04 '24 12:01 petcupaula