Skip to content

Commit

Permalink
build(deps): bump slang_flutter and slang (#2374)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pun Butrach <[email protected]>
  • Loading branch information
dependabot[bot] and validcube authored Jan 15, 2025
1 parent b3ba0fc commit dfb3fe3
Show file tree
Hide file tree
Showing 91 changed files with 41 additions and 453 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/sync_crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: 3.24.x
flutter-version: 3.27.x

- name: Sync translations from Crowdin
uses: crowdin/github-action@v1
uses: crowdin/github-action@v2
with:
config: crowdin.yml
upload_sources: true
Expand All @@ -47,26 +47,31 @@ jobs:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

# There has to be a better way to do this
- name: Normalization of Translation Strings
- name: Validation of synced translations
run: |
dart pub get
cd assets/i18n
sudo chmod 766 *.json
cd ../..
dart run slang validate
- name: Normalization of Translation Strings
run: |
sudo chmod 766 assets/i18n/*.i18n.json
dart run slang analyze
dart run slang clean
dart run slang normalize
cd assets/i18n
dart nuke.dart >> $GITHUB_STEP_SUMMARY
cd ../..
dart run slang
flutter analyze lib/gen/strings.g.dart --no-fatal-infos --no-fatal-warnings
- name: Commit translations
run: |
git config user.name revanced-bot
git config user.email [email protected]
sudo chown -R $USER:$USER .git
git commit -m "chore: Remove empty values from JSON" assets/i18n/strings_*.json
git commit -m "chore: Remove empty values from JSON" assets/i18n/*.i18n.json
git push origin HEAD:feat/translations
14 changes: 0 additions & 14 deletions assets/i18n/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion assets/i18n/strings.i18n.json → assets/i18n/en.i18n.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,4 @@
"install_failed_version_downgrade_description": "The installation failed due to the patched app being a lower version than the installed app.\n\nUninstall the app and try again?",
"status_unknown_description": "The installation failed due to an unknown reason. Please try again."
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 19 additions & 4 deletions assets/i18n/nuke.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ T? removeBlankEntries<T>(T? json) {
if (json is List) {
json.removeWhere((e) => e == null);
json.forEach(removeBlankEntries);
// If the list is empty after removing nulls, return null to remove it.
return json.isEmpty ? null : json;
} else if (json is Map) {
json.removeWhere(
(key, value) => key == null || value == null || value == '',
);
json.values.forEach(removeBlankEntries);
// If the map is empty after removing blank entries, return null to remove it.
return json.isEmpty ? null : json;

}
return json;
}
Expand All @@ -62,11 +67,21 @@ Future<void> processJsonFiles() async {
final String contents = await file.readAsString();
final dynamic json = jsonDecode(contents);
final dynamic processedJson = removeBlankEntries(json);
bool isEmpty = false;

if (processedJson is Map) {
isEmpty = processedJson.values.every((value) => value is Map && value.isEmpty);
}

file.writeAsString(
const JsonEncoder.withIndent(' ').convert(processedJson),
);
print('🥞 Task successful on: ${file.path}');
if (processedJson == null || isEmpty) {
await file.delete();
print('🗑️ File deleted: ${file.path}');
} else {
await file.writeAsString(
const JsonEncoder.withIndent(' ').convert(processedJson),
);
print('🥞 Task successful on: ${file.path}');
}
}
} catch (e) {
print('💥 Task failed on: ${file.path}: $e');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 0 additions & 19 deletions assets/i18n/strings_af_ZA.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_am_ET.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_as_IN.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_bs_BA.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_eu_ES.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_gl_ES.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_gu_IN.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_ka_GE.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_kn_IN.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_ky_KG.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_lo_LA.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_mk_MK.i18n.json

This file was deleted.

19 changes: 0 additions & 19 deletions assets/i18n/strings_ml_IN.i18n.json

This file was deleted.

Loading

0 comments on commit dfb3fe3

Please sign in to comment.