mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
20 lines
492 B
Dart
20 lines
492 B
Dart
/// Internationalization utilities
|
|
///
|
|
/// @author Pierre HUBERT
|
|
|
|
/// Translate a string
|
|
///
|
|
/// Translate a given [string] into the current language, if available
|
|
///
|
|
/// Then apply the list of [args] to the string, each argument name is
|
|
/// surrounded by '%'
|
|
String tr(String string, {Map<String, String> args}) {
|
|
//TODO : create translation system
|
|
|
|
//Apply arguments
|
|
if(args != null)
|
|
args.forEach((key, value) => string = string.replaceAll("%$key%", value));
|
|
|
|
return string;
|
|
}
|