This commit is contained in:
Muhammad Mohiuddin
2024-06-20 21:49:40 +02:00
parent 55ad0ff2e8
commit fc8498ae5a
4 changed files with 15 additions and 5 deletions

View File

@@ -0,0 +1,3 @@
strings:
ok: OK
cancel: CANCEL

View File

@@ -0,0 +1,3 @@
strings:
ok: OK
cancel: STORNIEREN

View File

@@ -38,12 +38,16 @@ class YamlBasedBuilder implements Builder {
final currentMap = loadYaml(contents) as YamlMap;
final currentKeys = currentMap.allKeys;
final allFiles = await buildStep.findAssets(Glob('**.i18n.yaml')).toList();
final pattern = Glob('**.i18n.yaml');
final allFiles = await buildStep.findAssets(pattern).toList();
final currentFileName = currentFile.pathSegments.last.replaceAll(
'.i18n.yaml',
'',
);
final defaultFile = allFiles.firstWhere(
(e) {
final name = e.uri.pathSegments.last.replaceAll(".i18n.yaml", "");
return !name.contains('_') && currentFile.pathSegments.last.replaceAll(".i18n.yaml", "").startsWith(name);
final name = e.uri.pathSegments.last.replaceAll('.i18n.yaml', '');
return !name.contains('_') && currentFileName.startsWith(name);
},
);

View File

@@ -15,7 +15,7 @@ dependencies:
glob: ^2.0.0
dev_dependencies:
lints: ^2.0.0
lints: ^4.0.0
test: ^1.16.8
build_runner: ^2.0.0
build_web_compilers: ^4.0.0