1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +00:00
comunicmobile/lib/utils/intl_utils.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;
}