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));
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) {

View File

@@ -1,5 +1,5 @@
# Generated by pub
# See http://pub.dartlang.org/doc/glossary.html#lockfile
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
@@ -21,7 +21,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.5"
version: "1.14.6"
flutter:
dependency: "direct main"
description: flutter
@@ -82,7 +82,7 @@ packages:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.5"
version: "1.7.6"
sky_engine:
dependency: transitive
description: flutter
@@ -108,7 +108,7 @@ packages:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.2"
version: "0.8.3"
stack_trace:
dependency: transitive
description:
@@ -150,6 +150,6 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.0"
version: "3.0.0"
sdks:
dart: ">=2.0.0-dev.23.0 <=2.0.0-edge.0d5cf900b021bf5c9fa593ffa12b15bcd1cc5fe0"

View File

@@ -7,7 +7,7 @@ dependencies:
path_provider: "^0.2.1+1"
sqflite: any
image_picker: '^0.1.3' # use for ask permissions @ iOS
xml: "^2.6.0"
xml: "^3.0.0"
flutter:
sdk: flutter