2019-04-21 09:44:07 +00:00
|
|
|
/// Internationalization utilities
|
|
|
|
///
|
|
|
|
/// @author Pierre HUBERT
|
|
|
|
|
|
|
|
/// Translate a string
|
|
|
|
///
|
|
|
|
/// Translate a given [string] into the current language, if available
|
2019-04-23 12:35:41 +00:00
|
|
|
///
|
|
|
|
/// Then apply the list of [args] to the string, each argument name is
|
|
|
|
/// surrounded by '%'
|
|
|
|
String tr(String string, {Map<String, String> args}) {
|
2019-04-21 09:44:07 +00:00
|
|
|
//TODO : create translation system
|
2019-04-23 12:35:41 +00:00
|
|
|
|
|
|
|
//Apply arguments
|
|
|
|
if(args != null)
|
|
|
|
args.forEach((key, value) => string = string.replaceAll("%$key%", value));
|
|
|
|
|
2019-04-21 09:44:07 +00:00
|
|
|
return string;
|
2019-04-23 12:35:41 +00:00
|
|
|
}
|