Skip to content

Migrate to Slang#344

Open
omeritzics wants to merge 4 commits into
mainfrom
slang
Open

Migrate to Slang#344
omeritzics wants to merge 4 commits into
mainfrom
slang

Conversation

@omeritzics
Copy link
Copy Markdown
Owner

@omeritzics omeritzics commented May 20, 2026

Work in progress.

Summary by CodeRabbit

  • Chores

    • Updated localization infrastructure to improve code consistency and maintainability across all application modules.
  • Refactor

    • Modernized internal string handling and translation dependencies to streamline localization workflows and reduce unnecessary abstraction layers.

Review Change Stack

@omeritzics omeritzics added this to the Qama v26.6 milestone May 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (3)
  • lib/main.dart
  • pubspec.yaml
  • slang.yaml
⛔ Files ignored due to path filters (4)
  • lib/gen/strings.g.dart is excluded by !**/gen/**
  • lib/gen/strings_ar.g.dart is excluded by !**/gen/**
  • lib/gen/strings_en_EO.g.dart is excluded by !**/gen/**
  • pubspec.lock is excluded by !**/*.lock
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 316cd5be-0160-4bca-b86e-41944036ad93

📥 Commits

Reviewing files that changed from the base of the PR and between 1944a15 and e52a5f8.

⛔ Files ignored due to path filters (4)
  • lib/gen/strings.g.dart is excluded by !**/gen/**
  • lib/gen/strings_ar.g.dart is excluded by !**/gen/**
  • lib/gen/strings_en_EO.g.dart is excluded by !**/gen/**
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • lib/main.dart
  • pubspec.yaml
  • slang.yaml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

All 20 Dart files across app sources and components systematically update their localization dependencies by removing imports of updatium/services/slang-converter.dart and adding direct imports of package:slang/slang.dart and package:updatium/gen/strings.g.dart. No code logic is altered.

Changes

Localization import migration

Layer / File(s) Summary
App source files localization imports
lib/app_sources/apkcombo.dart, lib/app_sources/aptoide.dart, lib/app_sources/bitbucket.dart, lib/app_sources/codeberg.dart, lib/app_sources/directAPKLink.dart, lib/app_sources/fdroid.dart, lib/app_sources/fdroidrepo.dart, lib/app_sources/gitea.dart, lib/app_sources/github.dart, lib/app_sources/gitlab.dart, lib/app_sources/html.dart, lib/app_sources/huaweiappgallery.dart, lib/app_sources/rustore.dart, lib/app_sources/sourcehut.dart, lib/app_sources/telegramapp.dart, lib/app_sources/tencent.dart, lib/app_sources/uptodown.dart, lib/app_sources/vivoappstore.dart
All 16 app source files remove slang-converter.dart imports and add direct slang and generated strings.g.dart imports, enabling string translation calls (t(...)) via the new generated strings module.
Component files localization imports
lib/components/category_chip.dart, lib/components/generated_form.dart
Component files update imports identically, removing slang-converter and adding slang and generated strings imports to support widget localization calls.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 From converters old to strings so bright,
We hop through imports, left then right.
Twenty files now sing in harmony—
Direct and generated, localization spree!
No logic changed, just wires rewired,
Clean imports—that's all that's required. 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Migrate to Slang' directly and concisely describes the main change across all modified files—replacing slang-converter imports with direct Slang package imports and generated strings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch slang

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces generated localization files for 39 locales using the slang package. Feedback indicates several critical issues that will prevent the project from compiling: the base English translation class is missing nearly all keys present in other locales, and it incorrectly includes dependency information as translation data. Additionally, multiple non-English locale files contain untranslated English strings and lack the required pluralization forms for languages like Arabic and Czech. Finally, the Esperanto locale is misconfigured with an incorrect language code.

Comment thread lib/gen/strings_en.g.dart
Comment on lines +12 to +44
class Translations with BaseTranslations<AppLocale, Translations> {
/// Returns the current translations of the given [context].
///
/// Usage:
/// final t = Translations.of(context);
static Translations of(BuildContext context) => InheritedLocaleData.of<AppLocale, Translations>(context).translations;

/// You can call this constructor and build your own translation instance of this locale.
/// Constructing via the enum [AppLocale.build] is preferred.
Translations({Map<String, Node>? overrides, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver, TranslationMetadata<AppLocale, Translations>? meta})
: assert(overrides == null, 'Set "translation_overrides: true" in order to enable this feature.'),
$meta = meta ?? TranslationMetadata(
locale: AppLocale.en,
overrides: overrides ?? {},
cardinalResolver: cardinalResolver,
ordinalResolver: ordinalResolver,
) {
$meta.setFlatMapFunction(_flatMapFunction);
}

/// Metadata for the translations of <en>.
@override final TranslationMetadata<AppLocale, Translations> $meta;

/// Access flat map
dynamic operator[](String key) => $meta.getTranslation(key);

late final Translations _root = this; // ignore: unused_field

Translations $copyWith({TranslationMetadata<AppLocale, Translations>? meta}) => Translations(meta: meta ?? this.$meta);

// Translations
late final TranslationsDependenciesEn dependencies = TranslationsDependenciesEn._(_root);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The base Translations class is missing almost all the translation keys (e.g., invalidURLForSource, noReleaseFound, primary, etc.) that are present in other locale files like strings_ar.g.dart. Since AppLocale.en is configured as the baseLocale in AppLocaleUtils, this class defines the interface that all other translations must implement. As it stands, the project will fail to compile because the other generated classes (like TranslationsAr) are attempting to override members that do not exist in the base class.

Additionally, the English locale contains a dependencies key that is missing from other locales, which is another source of compilation errors. It appears that slang might have processed an incorrect file (possibly containing dependency info) as the source for the English locale. Please ensure your base translation file (e.g., assets/translations/strings_en.i18n.json) is correctly populated with all keys.

Comment thread lib/gen/strings_ar.g.dart
Comment on lines +115 to +119
@override String appRemoved({required num n}) => (_root.$meta.cardinalResolver ?? PluralResolvers.cardinal('ar'))(n,
one: 'Removed one app',
two: 'Removed {count} apps',
other: 'Removed {count} apps',
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The pluralization strings for appRemoved are in English instead of Arabic. Furthermore, Arabic requires more plural forms (zero, few, many) to be grammatically correct, but only one, two, and other are provided here. This suggests the source translation file for Arabic is incomplete and relies on a fallback structure that doesn't match the target language's requirements.

Comment thread lib/gen/strings_cs.g.dart
Comment on lines +115 to +118
@override String appRemoved({required num n}) => (_root.$meta.cardinalResolver ?? PluralResolvers.cardinal('cs'))(n,
one: 'Removed one app',
other: 'Removed {count} apps',
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The pluralization strings for appRemoved are in English. Additionally, the Czech language requires the few and many plural forms for correctness, which are missing here. Please update the source translation file for the cs locale to include all required plural forms and their translations.

Comment thread lib/gen/strings_ar.g.dart
Comment thread lib/gen/strings.g.dart
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Note

Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

14 UNAVAILABLE: Connection dropped

This reverts commit 1944a15.
@omeritzics omeritzics modified the milestones: Qama v26.6, Qama 26.8 May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switching to Kurdish makes Updatium non-functional Replace easy_localization

1 participant