Fix double quotes escaping.

This commit is contained in:
Ivan Murashov
2018-03-19 23:59:39 +03:00
parent 1f8244840b
commit 6e6e20a7f3
3 changed files with 14 additions and 14 deletions

View File

@@ -10,18 +10,18 @@ class StringsLocalization {
static Future load(String l) async {
localeCode = l;
var document = xml.parse(await loadStrings(l));
strings.clear();
document.findAllElements('string').forEach((node) {
await rootBundle.loadString('assets/values-$localeCode/strings.xml').then((content) {
content.replaceAll('=\"', '=\\"');
content.replaceAll('\">', '\\">"');
var document = xml.parse(content);
strings.clear();
document.findAllElements('string').forEach((node) {
strings[node.attributes[0].value] = node.text.toString();
});
});
return strings;
}
static Future<String> loadStrings(String locale) async {
return await rootBundle.loadString('assets/values-$locale/strings.xml');
}
static String declineCurrency(int num, int code) {
int residual = num % 100;
if (residual >= 20) {