-
Notifications
You must be signed in to change notification settings - Fork 929
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(android,react,vue): support RTL layout (#893)
* feat(android): support RTL layout * feat(js): inject Localization to core js * feat(react): text input default align to right on RTL layout * feat(react): horiztonal scrollview on RTL layout * fix(android): set default ltr for boxshadow view * feat(react,vue): add Localization demo Co-authored-by: maxli <maxli@tencent.com> Co-authored-by: yitengzhu <yitengzhu@tencent.com>
- Loading branch information
1 parent
da964b9
commit e15753d
Showing
31 changed files
with
335 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
android/sdk/src/main/java/com/tencent/mtt/hippy/utils/I18nUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.tencent.mtt.hippy.utils; | ||
|
||
import android.os.Build; | ||
import android.os.LocaleList; | ||
import android.text.TextUtils; | ||
import android.view.View; | ||
import java.util.Locale; | ||
|
||
public class I18nUtil { | ||
private static Locale getLocale() { | ||
Locale locale; | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
locale = LocaleList.getDefault().get(0); | ||
} else { | ||
locale = Locale.getDefault(); | ||
} | ||
|
||
return locale; | ||
} | ||
|
||
public static boolean isRTL() { | ||
return getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; | ||
} | ||
|
||
public static int getLayoutDirection() { | ||
return TextUtils.getLayoutDirectionFromLocale(getLocale()); | ||
} | ||
|
||
public static String getLanguage() { | ||
return getLocale().getLanguage(); | ||
} | ||
|
||
public static String getCountry() { | ||
return getLocale().getCountry(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.