Skip to content
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

Added app_ar.arb to support Arabic translation ... #708

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

naderm11
Copy link

@naderm11 naderm11 commented May 26, 2024

and modified app.dart to support RTL layout. Not very familiar with Flutter code, so please review :)

Fixes: #803

…to support RTL layout. Not very familiar with Flutter code, so please review
@naderm11 naderm11 marked this pull request as ready for review May 26, 2024 17:32
naderm11 and others added 2 commits May 26, 2024 20:34
adding the Arabic file
@naderm11
Copy link
Author

fix #699

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @naderm11 for the contribution!

The main thing we'll want adjusted in these changes before we can merge them is to take each of the different ideas that are involved here and separate them into their own commit, with their own commit message explaining what they're for. You can read all about that here, and more briefly here; but I've also left specific comments below about what that means for this PR.

Comment on lines -120 to +123
localizationsDelegates: ZulipLocalizations.localizationsDelegates,
localizationsDelegates: const [
...ZulipLocalizations.localizationsDelegates,
GlobalMaterialLocalizations.delegate,
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, yeah, this looks like probably a needed change.

Just to confirm my understanding: what happens if you leave this change out?

Let's put this change in a commit of its own, perhaps at the start of the branch. (And the commit message can have the answer to my question about why it's needed.)

Comment on lines +122 to +125
...ZulipLocalizations.localizationsDelegates,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
Copy link
Member

Choose a reason for hiding this comment

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

nit: place in logical order:

Suggested change
...ZulipLocalizations.localizationsDelegates,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
...ZulipLocalizations.localizationsDelegates,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,

If our app-specific delegates go first, then the next-most-specific should go next, and so on to the most general delegate going at the end. The flutter/material package depends on flutter/cupertino which depends on flutter/widgets, so that gives the ordering.

@@ -129,7 +135,11 @@ class _ZulipAppState extends State<ZulipApp> with WidgetsBindingObserver {
(_) => widget._declareReady());
}
GlobalLocalizations.zulipLocalizations = ZulipLocalizations.of(context);
return child!;
final locale = Localizations.localeOf(context); // Get locale from context
Copy link
Member

Choose a reason for hiding this comment

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

nit: this comment says only information that's equally readable from the code itself, so just leave it out:

Suggested change
final locale = Localizations.localeOf(context); // Get locale from context
final locale = Localizations.localeOf(context);

Comment on lines +139 to +140
return Directionality(
textDirection: locale.languageCode == 'ar' ? TextDirection.rtl : TextDirection.ltr,
Copy link
Member

Choose a reason for hiding this comment

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

Huh, is this needed? I would have thought that Flutter would supply this automatically, in MaterialApp (and WidgetsApp which it's built around).

Looking in the Flutter source, it sure does look that way. It's also mentioned in the docs of Localization, which is one of the things WidgetsApp provides.

Suppose you leave this change out; how does the behavior change?

(If we do need a version of this change, it'll be another example of a change that should be its own separate commit.)

@@ -1,4 +1,5 @@
{
"@@locale": "en",
Copy link
Member

Choose a reason for hiding this comment

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

Hmm interesting. What's the effect of this / what led you to add it?

@gnprice
Copy link
Member

gnprice commented Jun 11, 2024

@naderm11 Do you think you'll be able to return to this PR and answer the questions above? It'd be great to have this completed and merged.

@chrisbobbe
Copy link
Collaborator

chrisbobbe commented Jul 11, 2024

This would be helpful indeed. 🙂 Updated the description with Fixes: #803.

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.

i18n: Add a RTL language
3 participants