-
Notifications
You must be signed in to change notification settings - Fork 315
Add support for 'raj' locale in the application #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Add support for 'raj' locale in the application #605
Conversation
|
🎉 Welcome @rahul-vyas-dev!
We appreciate your contribution! 🚀 |
WalkthroughAdds Rajasthani ("raj") locale: updates iOS bundle and l10n config, registers Raj localization delegates in the app, introduces Raj Intl/provider code and Material localizations, adds ARB resource and generated AppLocalizationsRaj with translations and plural/select implementations. Changes
Sequence Diagram(s)sequenceDiagram
participant Platform as Platform Locale
participant App as GetMaterialApp
participant L10n as AppLocalizations
participant MaterialL as MaterialLocalizations
Note over Platform,App: App start / incoming locale
Platform->>App: Locale(languageCode: "raj")
App->>App: localeResolutionCallback(locale)
alt languageCode == 'raj'
App-->>App: select Locale('raj')
else match supportedLocales
App-->>App: select first supported match
else
App-->>App: fallback Locale('en')
end
App->>L10n: lookupAppLocalizations(Locale('raj'))
L10n-->>App: AppLocalizationsRaj instance
App->>MaterialL: load Raj Material delegate
MaterialL-->>App: AppLocalizationsRaj (Material variants)
Note over L10n,MaterialL: Intl/date-number formats initialized for 'raj'
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
@M4dhav please review |
|
Looks like Rajasthani has a ISO 639-2. Language Spec code. As far as I know, |
M4dhav
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide a video to verify that this works in-app
|
Hey @M4dhav ! Actually my Flutter setup got corrupted recently, and I’m facing issues getting the environment working again (I also mentioned this in the Discord server). Because of that, I’m not able to re-run the project right now, and I didn’t record any video when I initially tested it. |
|
@M4dhav if you want any changes then let me know i am here for that |
|
While the tests did pass, I cannot merge this without verifying that ISO 639-2 codes work. Alternatively, could you find me a source that confirms ISO 639-2 are supported by |
|
hey @M4dhav I verify the ARB messages using the check_arb.dart script, and the output looks correct. Here’s what I got: dart "c:\Users\rahul\Resonate\tools\check_arb.dart"
Code that i have usedimport 'dart:convert';
import 'dart:io';
void main(List<String> args) async {
final path = args.isNotEmpty ? args.first : 'lib/l10n/app_raj.arb';
final file = File(path);
if (!await file.exists()) {
stderr.writeln('File not found: $path');
exit(2);
}
final content = await file.readAsString();
Map<String, dynamic> json;
try {
json = jsonDecode(content) as Map<String, dynamic>;
} catch (e) {
stderr.writeln('Invalid JSON in $path: $e');
exit(3);
}
stdout.writeln('Loaded ARB: $path');
stdout.writeln('Locale: ${json['@@locale'] ?? '<none>'}');
stdout.writeln(
'Messages found: ${json.keys.where((k) => !k.startsWith('@')).length}',
);
stdout.writeln('');
final tests = <String, Map<String, Object?>>{
'title': {},
'noAvailableRoom': {'isRoom': 'true'},
'noAvailableRoom#2': {'isRoom': 'false'},
'minutesAgo': {'count': 1},
'minutesAgo#2': {'count': 5},
};
for (final entry in tests.entries) {
final rawKey = entry.key.contains('#')
? entry.key.split('#').first
: entry.key;
final sampleName = entry.key;
final argsForKey = entry.value;
final raw = json[rawKey];
if (raw == null) {
stdout.writeln(' - $sampleName: <missing key in ARB>');
continue;
}
final formatted = formatMessage(raw.toString(), argsForKey);
stdout.writeln(' - $sampleName => $formatted');
}
}
String formatMessage(String msg, Map<String, Object?> args) {
var out = msg;
final selectRe = RegExp(r'\{(\w+),\s*select,([\s\S]*?)\}');
out = out.replaceAllMapped(selectRe, (m) {
final varName = m[1]!;
final body = m[2]!;
final choice = _pickSelectChoice(body, args[varName]?.toString());
return choice;
});
final pluralRe = RegExp(r'\{(\w+),\s*plural,([\s\S]*?)\}');
out = out.replaceAllMapped(pluralRe, (m) {
final varName = m[1]!;
final body = m[2]!;
final count = args[varName];
final choice = _pickPluralChoice(body, count);
return choice;
});
final placeholderRe = RegExp(r'\{(\w+)\}');
out = out.replaceAllMapped(placeholderRe, (m) {
final n = m[1]!;
if (args.containsKey(n) && args[n] != null) return args[n].toString();
return '{${n}}';
});
out = out.replaceAll(r'\n', '\n');
return out;
}
String _pickSelectChoice(String body, String? value) {
final tokenRe = RegExp(r'(\w+)\{([^}]*)\}');
final matches = tokenRe.allMatches(body);
String? other;
for (final m in matches) {
final k = m[1]!;
final v = m[2]!;
if (k == 'other') other = v;
if (value != null && value == k) return v;
}
return other ?? '';
}
String _pickPluralChoice(String body, Object? countObj) {
final count = (countObj is num) ? countObj.toInt() : null;
final tokenRe = RegExp(r'(=?\d+|other)\{([^}]*)\}');
final matches = tokenRe.allMatches(body);
String? other;
final map = <String, String>{};
for (final m in matches) {
final k = m[1]!;
final v = m[2]!;
map[k] = v;
if (k == 'other') other = v;
}
if (count != null) {
final eqKey = '=${count}';
if (map.containsKey(eqKey))
return map[eqKey]!.replaceAll('{count}', count.toString());
if (count == 0 && map.containsKey('=0'))
return map['=0']!.replaceAll('{count}', '0');
if (count == 1 && map.containsKey('=1'))
return map['=1']!.replaceAll('{count}', '1');
return (other ?? '').replaceAll('{count}', count.toString());
}
return other ?? '';
} |
|
Hey @M4dhav , if you’d prefer not to use the ISO 639-2 code “raj”, I can use the raj_IN format instead — it will work properly as well. |
raj_IN does not make a difference, root issue is still that it is a 3 letter country code |
|
Hey @rahul-vyas-dev I just checked your PR Locally, and the app does not, in fact, run with the |
working on it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/main.dart
Outdated
| localeResolutionCallback: (locale, supportedLocales) { | ||
| if (locale != null && locale.languageCode == 'raj') { | ||
| return const Locale('raj'); | ||
| } | ||
| for (final supportedLocale in supportedLocales) { | ||
| if (supportedLocale.languageCode == locale?.languageCode) { | ||
| return supportedLocale; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was code added to main.dart?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confusion! The changes in main.dart were added because this branch includes the new Rajasthani (raj) language support. To enable that, the app needed an updated localeResolutionCallback and localization setup inside GetMaterialApp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @M4dhav , if you have a better approach to resolve this, please let me know so that i can resolve this issue asap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the preferred approach. Adding confguration for a specific language is not recommended. I do not think it is possible to add Rajasthani for now, and so I am closing the PR. Please feel free to reopen if you find an alternate way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @M4dhav what if i use either 'rj' instead of 'raj' or BCP-47 ('raj-IN')
please let me know
|
✅ PR Closed - Thank You, @rahul-vyas-dev!
We appreciate your effort and look forward to more contributions from you! 🤝 |
- Introduced a new localization file `raj_intl.dart` containing date patterns and symbols for the Rajasthani language. - Implemented the `AppLocalizationsRaj` class extending `GlobalMaterialLocalizations` to provide localized strings and formats. - Updated `main.dart` to include the Rajasthani localization delegate in the app's localization setup. Added support for Rajesthani Language
|
“Hey @M4dhav , can you please reopen this PR? I have fixed the issue and can update it further. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
♻️ Duplicate comments (6)
untranslated.txt (1)
72-104: Critical: Three-letter ISO 639-2 language code 'raj' is not supported by Flutter.Per the PR discussion and maintainer testing, the app crashes when the 'raj' localization is present, specifically when opening the App Preferences page. The root issue is that
flutter_localizationssupports ISO 639-1 two-letter language codes, but Rajasthani uses the ISO 639-2 three-letter code 'raj'.According to web search results referenced in past comments, flutter_localizations does not include ISO 639-2 code "raj" in its built-in supported languages.
This is a blocking issue that prevents the PR from being merged. The maintainer has confirmed this approach cannot work and closed the PR accordingly. Adding the locale to this file (and all other localization files) will not resolve the underlying Flutter framework limitation.
lib/main.dart (2)
15-15: Critical: Import for unsupported three-letter language code.This import is part of the attempt to add Rajasthani using the three-letter code "raj", which flutter_localizations does not support. The maintainer confirmed the app fails to run with this localization present.
89-89: Critical: Registering delegate for unsupported locale causes app crashes.The maintainer tested this change locally and confirmed the app fails to run when the 'raj' localization is present, specifically crashing when opening the App Preferences page.
Per past review comments, flutter_localizations does not support ISO 639-2 three-letter language codes like 'raj', and the maintainer stated "This is not the preferred approach. Adding configuration for a specific language is not recommended".
Required action: Remove this delegate registration until a viable solution for three-letter language codes is found or an alternative two-letter code approach is identified.
lib/l10n/app_localizations.dart (1)
13-13: Critical: Adding 'raj' locale violates Flutter's language code requirements.These changes integrate the 'raj' locale throughout the localization system, but flutter_localizations does not support ISO 639-2 three-letter language codes. The maintainer confirmed the app fails to run with this localization present.
Adding
Locale('raj')to supportedLocales and the lookup logic does not overcome the underlying Flutter framework limitation. The built-in Material and Cupertino localizations will fail when attempting to load resources for the three-letter code.Also applies to: 103-103, 2482-2482, 2497-2498
lib/l10n/raj_intl.dart (1)
209-245: Critical: Custom delegate for unsupported three-letter language code.This custom
LocalizationsDelegateattempts to provide Material localizations for the 'raj' locale, but flutter_localizations does not support ISO 639-2 three-letter language codes. The maintainer confirmed the app crashes when this localization is present.While creating a custom delegate is the correct approach for adding app-specific translations, it cannot overcome Flutter's built-in limitation regarding three-letter language codes in the Material and Cupertino localization delegates.
lib/l10n/app_localizations_raj.dart (1)
1-1306: Note: This file cannot be used until the three-letter language code issue is resolved.While this file provides comprehensive Rajasthani translations (aside from the incomplete sections noted in other comments), the fundamental issue is that flutter_localizations does not support the ISO 639-2 three-letter code 'raj'. The maintainer confirmed the app crashes when this localization is present.
The translation work here is valuable, but the file cannot be integrated until either:
- A two-letter language code alternative is identified for Rajasthani
- Flutter adds support for three-letter ISO 639-2 codes
- An alternative localization approach is developed
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
lib/l10n/app_localizations.dart(5 hunks)lib/l10n/app_localizations_raj.dart(1 hunks)lib/l10n/raj_intl.dart(1 hunks)lib/main.dart(2 hunks)untranslated.txt(1 hunks)
🔇 Additional comments (1)
lib/l10n/raj_intl.dart (1)
12-57: Review date format patterns for Rajasthani conventions.The date format patterns defined here should follow Rajasthani/Indian conventions. Please verify these patterns are appropriate for Rajasthani speakers, particularly:
- Date ordering (d.M.y vs. other formats)
- Date/time separators
- 24-hour time format usage
Consider consulting with native Rajasthani speakers or reviewing similar Indian language implementations to ensure cultural appropriateness.
lib/l10n/app_localizations_raj.dart
Outdated
| String get hide => 'Remove'; | ||
|
|
||
| @override | ||
| String get removeRoom => 'Remove Room'; | ||
|
|
||
| @override | ||
| String get removeRoomFromList => 'Remove from list'; | ||
|
|
||
| @override | ||
| String get removeRoomConfirmation => 'Are you sure you want to remove this upcoming room from your list?'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major: Additional untranslated strings remain in English.
Several strings throughout the file remain in English:
Room management (lines 391-400):
'Remove','Remove Room','Remove from list','Are you sure you want to remove this upcoming room from your list?'
Search functionality (lines 554, 718-740):
- Line 554:
'Failed to search rooms. Please try again.' - Lines 718-740:
'Search rooms...','Searching rooms...','Clear search','Search Error','Failed to search rooms. Please try again.','Failed to search upcoming rooms. Please try again.','Search','Clear'
Room removal feedback (lines 1227-1230):
'Failed to remove room','Room removed from your list successfully'
These should be translated to Rajasthani for consistency with the rest of the file.
Also applies to: 554-554, 718-740, 1227-1230
🤖 Prompt for AI Agents
In lib/l10n/app_localizations_raj.dart around lines 391-400, 554, 718-740, and
1227-1230 the listed getters still return English strings; replace each English
string with the correct Rajasthani translation (Hide/Remove, Remove Room, Remove
from list, confirmation sentence, search-related strings, and room removal
feedback) by updating the getter return values to their Rajasthani equivalents,
preserve punctuation and interpolation, keep @override annotations intact, and
run the localization/formatting tests or l10n extraction to verify no key/name
changes broke consumers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok working on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rahul-vyas-dev, sounds good! Let me know if you need any help with the Rajasthani translations. 👍
| const rajDateSymbols = { | ||
| 'NAME': 'nn', | ||
| 'ERAS': <dynamic>['f.Kr.', 'e.Kr.'], | ||
|
|
||
| 'ERANAMES': <dynamic>['før Kristus', 'etter Kristus'], | ||
| 'NARROWMONTHS': <dynamic>[ | ||
| 'J', | ||
| 'F', | ||
| 'M', | ||
| 'A', | ||
| 'M', | ||
| 'J', | ||
| 'J', | ||
| 'A', | ||
| 'S', | ||
| 'O', | ||
| 'N', | ||
| 'D', | ||
| ], | ||
| 'STANDALONENARROWMONTHS': <dynamic>[ | ||
| 'J', | ||
| 'F', | ||
| 'M', | ||
| 'A', | ||
| 'M', | ||
| 'J', | ||
| 'J', | ||
| 'A', | ||
| 'S', | ||
| 'O', | ||
| 'N', | ||
| 'D', | ||
| ], | ||
| 'MONTHS': <dynamic>[ | ||
| 'januar', | ||
| 'februar', | ||
| 'mars', | ||
| 'april', | ||
| 'mai', | ||
| 'juni', | ||
| 'juli', | ||
| 'august', | ||
| 'september', | ||
| 'oktober', | ||
| 'november', | ||
| 'desember', | ||
| ], | ||
| 'STANDALONEMONTHS': <dynamic>[ | ||
| 'januar', | ||
| 'februar', | ||
| 'mars', | ||
| 'april', | ||
| 'mai', | ||
| 'juni', | ||
| 'juli', | ||
| 'august', | ||
| 'september', | ||
| 'oktober', | ||
| 'november', | ||
| 'desember', | ||
| ], | ||
| 'SHORTMONTHS': <dynamic>[ | ||
| 'jan.', | ||
| 'feb.', | ||
| 'mar.', | ||
| 'apr.', | ||
| 'mai', | ||
| 'jun.', | ||
| 'jul.', | ||
| 'aug.', | ||
| 'sep.', | ||
| 'okt.', | ||
| 'nov.', | ||
| 'des.', | ||
| ], | ||
| 'STANDALONESHORTMONTHS': <dynamic>[ | ||
| 'jan', | ||
| 'feb', | ||
| 'mar', | ||
| 'apr', | ||
| 'mai', | ||
| 'jun', | ||
| 'jul', | ||
| 'aug', | ||
| 'sep', | ||
| 'okt', | ||
| 'nov', | ||
| 'des', | ||
| ], | ||
| 'WEEKDAYS': <dynamic>[ | ||
| 'søndag', | ||
| 'mandag', | ||
| 'tirsdag', | ||
| 'onsdag', | ||
| 'torsdag', | ||
| 'fredag', | ||
| 'lørdag', | ||
| ], | ||
| 'STANDALONEWEEKDAYS': <dynamic>[ | ||
| 'søndag', | ||
| 'mandag', | ||
| 'tirsdag', | ||
| 'onsdag', | ||
| 'torsdag', | ||
| 'fredag', | ||
| 'lørdag', | ||
| ], | ||
| 'SHORTWEEKDAYS': <dynamic>[ | ||
| 'søn.', | ||
| 'man.', | ||
| 'tir.', | ||
| 'ons.', | ||
| 'tor.', | ||
| 'fre.', | ||
| 'lør.', | ||
| ], | ||
| 'STANDALONESHORTWEEKDAYS': <dynamic>[ | ||
| 'søn.', | ||
| 'man.', | ||
| 'tir.', | ||
| 'ons.', | ||
| 'tor.', | ||
| 'fre.', | ||
| 'lør.', | ||
| ], | ||
| 'NARROWWEEKDAYS': <dynamic>['S', 'M', 'T', 'O', 'T', 'F', 'L'], | ||
| 'STANDALONENARROWWEEKDAYS': <dynamic>['S', 'M', 'T', 'O', 'T', 'F', 'L'], | ||
| 'SHORTQUARTERS': <dynamic>['K1', 'K2', 'K3', 'K4'], | ||
| 'QUARTERS': <dynamic>['1. kvartal', '2. kvartal', '3. kvartal', '4. kvartal'], | ||
| 'AMPMS': <dynamic>['a.m.', 'p.m.'], | ||
| 'DATEFORMATS': <dynamic>[ | ||
| 'EEEE d. MMMM y', | ||
| 'd. MMMM y', | ||
| 'd. MMM y', | ||
| 'dd.MM.y', | ||
| ], | ||
| 'TIMEFORMATS': <dynamic>['HH:mm:ss zzzz', 'HH:mm:ss z', 'HH:mm:ss', 'HH:mm'], | ||
| 'AVAILABLEFORMATS': null, | ||
| 'FIRSTDAYOFWEEK': 0, | ||
| 'WEEKENDRANGE': <dynamic>[5, 6], | ||
| 'FIRSTWEEKCUTOFFDAY': 3, | ||
| 'DATETIMEFORMATS': <dynamic>[ | ||
| '{1} {0}', | ||
| '{1} \'kl\'. {0}', | ||
| '{1}, {0}', | ||
| '{1}, {0}', | ||
| ], | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Date symbols use Norwegian language instead of Rajasthani.
The rajDateSymbols map contains Norwegian language text rather than Rajasthani:
- Eras (lines 61-63): "f.Kr.", "e.Kr.", "før Kristus", "etter Kristus" are Norwegian
- Months (lines 92-147): "januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember" are Norwegian
- Weekdays (lines 148-183): "søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag" are Norwegian
- Quarters (line 187): "kvartal" is Norwegian
These should be translated to Rajasthani to match the locale being implemented. For example, months in Rajasthani could use Devanagari script similar to the translations in app_localizations_raj.dart (e.g., lines 619-652 which use proper Rajasthani text like "जन", "फर", "मार्च", etc.).
🤖 Prompt for AI Agents
In lib/l10n/raj_intl.dart around lines 59 to 206, the date symbol map currently
contains Norwegian values (eras, era names, months, short months, standalone
months, weekdays, short weekdays, quarters, etc.); replace those Norwegian
strings with the correct Rajasthani equivalents (use Devanagari forms from
app_localizations_raj.dart lines ~619-652 as reference for month and weekday
names/abbreviations), update ERAS and ERANAMES to Rajasthani text, translate
SHORTMONTHS/STANDALONESHORTMONTHS and WEEKDAYS/STANDALONEWEEKDAYS/SHORTWEEKDAYS
accordingly, and change QUARTERS/SHORTQUARTERS to Rajasthani terms so all locale
strings consistently reflect the Rajasthani locale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (5)
untranslated.txt (1)
70-104: Raj entry inuntranslated.txtis structurally fine; confirm it reflects your current translation statusThe new
"raj"block is well‑formed and its keys line up with the corresponding getters inAppLocalizationsRaj(e.g.,appPreferences,transcriptionModel*,whisperModel*,search*,hide/remove*). That’s good for keeping tooling likecheck_arb.dartin sync.However, since this file appears to track untranslated keys, please double‑check that all of these Raj strings are indeed still intentionally English (many of them are in
app_localizations_raj.dart). If you later translate them, remember to regenerate/update this file so it doesn’t list stale “untranslated” entries forraj.lib/l10n/raj_intl.dart (3)
245-252: Use the Raj locale forshortMonthDayFormatto keep date formats consistentAll other date formats here are created with
localeName, butshortMonthDayFormatomits it:shortMonthDayFormat: intl.DateFormat('MMM d'),This will fall back to the default locale (typically
en_US), which is inconsistent with the Raj locale and your custom date symbols.Recommend:
- shortMonthDayFormat: intl.DateFormat('MMM d'), + shortMonthDayFormat: intl.DateFormat('MMM d', localeName),This keeps all date formats aligned with the active Raj locale.
422-423: Consider using a non‑English script category for Raj (Devanagari) text@override ScriptCategory get scriptCategory => ScriptCategory.englishLike;Rajasthani here is written in Devanagari, not Latin. For better typography and spacing, it’s usually preferable to align
scriptCategorywith whatever Flutter uses for other Devanagari‑based locales (e.g., Hindi), rather thanenglishLike.I’d suggest checking the
GlobalMaterialLocalizationsimplementation forhi(or another Indic locale) and mirroring thatScriptCategoryto ensure consistent layout.
221-258: Rename this Material‑localizations class to avoid confusion with the app‑levelAppLocalizationsRajThis file defines:
class AppLocalizationsRaj extends GlobalMaterialLocalizations { ... } static const LocalizationsDelegate<MaterialLocalizations> delegate = _AppLocalizationsRajs();while
lib/l10n/app_localizations_raj.dartalso defines a completely different:class AppLocalizationsRaj extends AppLocalizations { ... }Because they live in different libraries you don’t immediately get a compile error, but:
- It’s very easy for future imports to accidentally pull in the wrong
AppLocalizationsRaj.- The name strongly suggests this is the app‑string localization, whereas this class actually provides Material localizations.
To reduce confusion and avoid future symbol collisions, I recommend renaming the Material one here, for example:
-class AppLocalizationsRaj extends GlobalMaterialLocalizations { +class RajMaterialLocalizations extends GlobalMaterialLocalizations { @@ - static const LocalizationsDelegate<MaterialLocalizations> delegate = - _AppLocalizationsRajs(); + static const LocalizationsDelegate<MaterialLocalizations> delegate = + _RajMaterialLocalizationsDelegate();…and rename
_AppLocalizationsRajsto_RajMaterialLocalizationsDelegate, updatingmain.dart(or wherever you register the delegate) to referenceRajMaterialLocalizations.delegateinstead.This keeps the naming clear:
AppLocalizations*for app strings,*MaterialLocalizationsfor Material UI.Also applies to: 260-273, 487-488
lib/l10n/app_localizations_raj.dart (1)
319-365: Several Raj strings remain English (likely intentional but worth confirming)In this class a number of keys that were explicitly added for Raj in
untranslated.txtare still English, for example:
- App preferences / transcription model section:
appPreferences => 'App Preferences'transcriptionModel => 'Transcription Model'transcriptionModelDescription, allwhisperModel*labels and descriptions,modelDownloadInfo- Room removal & search:
hide => 'Remove',removeRoom => 'Remove Room',removeRoomFromList => 'Remove from list',
removeRoomConfirmation => 'Are you sure you want to remove this upcoming room from your list?'searchFailed,searchRooms,searchingRooms,clearSearch,searchError,
searchRoomsError,searchUpcomingRoomsError,search,clearfailedToRemoveRoom,roomRemovedSuccessfullyIf the intent is full Raj UI coverage, these will continue to appear in English even when the locale is set to
raj. That’s consistent with the new"raj"block inuntranslated.txt, but you may want to either:
- Translate them now and regenerate
untranslated.txt, or- Explicitly treat them as known/untranslated for this release so expectations are clear.
No functional bug here, just a content/UX detail to confirm.
Also applies to: 391-403, 404-405, 414-421, 430-431, 554-567, 718-739, 1227-1230
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
lib/l10n/app_localizations.dart(5 hunks)lib/l10n/app_localizations_raj.dart(1 hunks)lib/l10n/raj_intl.dart(1 hunks)lib/main.dart(2 hunks)untranslated.txt(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- lib/l10n/app_localizations.dart
- lib/main.dart
|
hey @M4dhav review it and Sorry for making changes in the main.dart file, but it was necessary to add the custom class instance to support the Raj (three-letter) language code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (3)
lib/l10n/app_localizations_raj.dart (3)
553-553: Major: English text remains untranslated.Line 553 still contains English text instead of Rajasthani:
'Failed to search rooms. Please try again.'This was flagged in a previous review but has not been addressed. Please translate this to Rajasthani to match the rest of the localization file.
717-738: Major: Multiple search-related strings remain in English.Lines 717-738 contain English text instead of Rajasthani translations:
'Search rooms...''Searching rooms...''Clear search''Search Error''Failed to search rooms. Please try again.''Failed to search upcoming rooms. Please try again.''Search''Clear'These were flagged in a previous review but remain untranslated. Please translate all of these to Rajasthani for consistency with the rest of the file.
1226-1229: Major: Room removal feedback strings remain in English.Lines 1226 and 1229 still contain English text:
- Line 1226:
'Failed to remove room'- Line 1229:
'Room removed from your list successfully'These were flagged in a previous review but have not been translated to Rajasthani. Please complete the translation.
🧹 Nitpick comments (2)
lib/l10n/raj_intl.dart (2)
251-251: Minor: Missing locale parameter for consistency.Line 251 initializes
shortMonthDayFormatwithout a locale parameter:shortMonthDayFormat: intl.DateFormat('MMM d'),For consistency with the other date format initializations (lines 245-250), consider adding the
localeNameparameter:- shortMonthDayFormat: intl.DateFormat('MMM d'), + shortMonthDayFormat: intl.DateFormat('MMM d', localeName),
275-760: Consider translating Material widget strings to Rajasthani.The Material localization strings (lines 275-760) are currently in English, such as:
- Line 276:
'More'- Line 282:
'Alert'- Line 289:
'Back'- Line 292:
'CANCEL'For a complete Rajasthani localization experience, these Material widget labels could be translated. However, if these are intentionally kept in English (e.g., following framework conventions or for technical reasons), this is acceptable.
Could you clarify whether Material widget strings should remain in English or be translated to Rajasthani?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/l10n/app_localizations_raj.dart(1 hunks)lib/l10n/raj_intl.dart(1 hunks)
🔇 Additional comments (3)
lib/l10n/raj_intl.dart (3)
7-10: LGTM: Import alias conflict resolved.The conflicting import aliases have been fixed. The imports now use distinct prefixes (
intlandsymbols), which resolves the previous compile-time error.
59-219: LGTM: Date symbols now use Rajasthani.The date symbols have been corrected from Norwegian to Rajasthani/Devanagari script. The eras, months, weekdays, and quarters are now properly localized.
260-273: No naming conflict exists. The original review comment misidentifies how Dart's import system works.The two
AppLocalizationsRajclasses exist in separate namespaces:
lib/l10n/raj_intl.dart: Material localization delegate (imported directly inmain.dart)lib/l10n/app_localizations_raj.dart: App-specific localizations (imported withinapp_localizations.dart, never directly exposed tomain.dart)When
main.dartusesAppLocalizationsRaj.delegate(line 89), it accesses the Material version fromraj_intl.dart. Whenapp_localizations.dartinstantiatesAppLocalizationsRaj()(line 2498), it uses the app-specific version fromapp_localizations_raj.dart. These operate in different scopes and never conflict.This follows standard Flutter localization patterns where Material localization files (
*_intl.dart) and app-specific localization files (app_localizations_*.dart) coexist with identical naming conventions.Likely an incorrect or invalid review comment.
|
Please change base branch of PR to Dev |
|
hey @M4dhav review please |
Description
This pull request adds support for the Rajasthani language to the project.
The update includes new translation files, proper localization setup, and integration with the existing i18n workflow.
This change ensures users can switch to the Rajasthani language and experience the UI fully translated.
Fixes #604
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Tested the Rajasthani translation file locally by running the project.
Verified that all keys display correctly and no missing translation warnings appear.
Manually checked each updated screen to confirm the translated strings are rendered as expected.
Tested switching languages from the settings menu to ensure Rajasthani is selectable.
Test Steps:
Pull the latest codebase.
Switch the app language to Rajasthani.
Navigate through pages to confirm translations load correctly.
Checklist:
Maintainer Checklist
Summary by CodeRabbit
New Features
Chores