b3nedikt / applocale Goto Github PK
View Code? Open in Web Editor NEWAppLocale is a android library to update the app language dynamically.
License: Apache License 2.0
AppLocale is a android library to update the app language dynamically.
License: Apache License 2.0
Hello! Is there a chance that application context wrapping:
override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(AppLocale.wrap(newBase))
}
will not work for some cases, where particular Context
implementation is expected internally?
It seems like we're getting the next exceptions with androidx.work
because of this:
Fatal Exception: java.lang.RuntimeException: Unable to start receiver androidx.work.impl.background.systemalarm.RescheduleReceiver: java.lang.ClassCastException: yb.c cannot be cast to android.app.ContextImpl
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3107)
at android.app.ActivityThread.-wrap18(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1611)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
(We've got only obfuscated stack trace for now (yb.c
), but I'll try to get a normal one if that can help)
Thanks for the great codebase.
After integration, I have observed that V1.2.6 is not persisting in the desired locale.
After changing the desired locale, if you close the app from recent and reopen again then you will observe that it's not persisting the desired locale.
when apply locale change everything is ok but only problem menu item of com.google.android.material.navigation.NavigationView
.
menu item localize doesn't change
HI,
I have integrated the AppLocale library and able to change to other languages like French, but I am not able to switch to Arabic.
The Kotlin code used to set Arabic is:
AppLocale.desiredLocale = Locale("ar")
After setting the locale, Im also using reword to trigger the change.
I have placed the Arabic strings in their respective values-ar strings.xml file
Please let me know if I am doing any mistake or does AppLocale support Arabic language?
Im also having one more issue:
When I change the language for example from English to French, the Appbar/toolbar title is not being changed as per the Locale. Im using Jetpack Navigation in my app. Titles for these destinations are set in the navigation.xml file using string resources.
The reword_version = "4.0.1"
Your feedback will be of great help. Thanks in advance.
Hi,
Webview is crashing, but not able to reproduce exact case. we have used the below version of the restring library
restrings = '5.1.4'
viewpump = '4.0.7'
reword = '4.0.1'
applocale = '2.0.3'
we are using 1.3.1 of appcompact.
below is the crash from stack trace which is not reproducable everytime, i was just trying to navigate to different window or something inside webview then i got this crash.
E/ViewSystem: ViewRootImpl #2 Surface is not valid.
E/ViewRootImpl: sendUserActionEvent() mView == null
E/ViewSystem: ViewRootImpl #2 Surface is not valid.
E/ViewSystem: ViewRootImpl #2 Surface is not valid.
E/MotionRecognitionManager: mSContextService = null
E/MotionRecognitionManager: motionService = null
E/WebEngage: App has crashed
android.content.res.Resources$NotFoundException: String resource ID #0x313004a
E/SensorManager: nativeGetSensorAtIndex: name, vendor - 0, K2HH Acceleration , STM
E/SensorManager: nativeGetSensorAtIndex: name, vendor - 1, GP2A002 Proximity Sensor, SHARP
E/SensorManager: nativeGetSensorAtIndex: name, vendor - 2, Screen Orientation Sensor, Samsung Electronics
E/File: fail readDirectory() errno=2
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.next.nlp, PID: 16554
android.content.res.Resources$NotFoundException: String resource ID #0x313004a
at android.content.res.Resources.getText(Resources.java:1484)
at android.content.res.Resources.getString(Resources.java:1580)
at dev.b3nedikt.restring.internal.ResourcesDelegate.getString(ResourcesDelegate.kt:50)
at dev.b3nedikt.restring.internal.RestringResources.getString(RestringResources.kt:41)
at android.content.Context.getString(Context.java:415)
at org.chromium.content.browser.selection.SelectionPopupControllerImpl.j(chromium-SystemWebViewGoogle.aab-stable-460607100:49)
at b9.onActionItemClicked(chromium-SystemWebViewGoogle.aab-stable-460607100:19)
at my.onActionItemClicked(chromium-SystemWebViewGoogle.aab-stable-460607100:1)
at com.android.internal.policy.PhoneWindow$DecorView$ActionModeCallback2Wrapper.onActionItemClicked(PhoneWindow.java:4234)
at com.android.internal.view.FloatingActionMode$4.onMenuItemSelected(FloatingActionMode.java:108)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:801)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:158)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:954)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:944)
at com.android.internal.view.FloatingActionMode$5.onMenuItemClick(FloatingActionMode.java:138)
at com.android.internal.widget.FloatingToolbar$FloatingToolbarMainPanel$1.onClick(FloatingToolbar.java:1298)
at android.view.View.performClick(View.java:5716)
at android.widget.TextView.performClick(TextView.java:10926)
at android.view.View$PerformClick.run(View.java:22596)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
E/File: fail readDirectory() errno=2
E/File: fail readDirectory() errno=2
E/WebEngage: App was crashed last time,
2023/02/08 09:36:14.225 : [CRASH] Unable to instantiate receiver androidx.work.impl.background.systemalarm.RescheduleReceiver: java.lang.ClassCastException: dev.b3nedikt.app_locale.AppLocaleContextWrapper cannot be cast to android.app.ContextImpl
2023/02/08 09:36:14.250 : [TRACE] android.app.ActivityThread.handleReceiver(ActivityThread.java:4929)
2023/02/08 09:36:14.265 : [TRACE] android.app.ActivityThread.access$1900(ActivityThread.java:324)
2023/02/08 09:36:14.277 : [TRACE] android.app.ActivityThread$H.handleMessage(ActivityThread.java:2347)
2023/02/08 09:36:14.290 : [TRACE] android.os.Handler.dispatchMessage(Handler.java:106)
2023/02/08 09:36:14.321 : [TRACE] android.os.Looper.loopOnce(Looper.java:226)
2023/02/08 09:36:14.333 : [TRACE] android.os.Looper.loop(Looper.java:313)
2023/02/08 09:36:14.341 : [TRACE] android.app.ActivityThread.main(ActivityThread.java:8855)
2023/02/08 09:36:14.349 : [TRACE] java.lang.reflect.Method.invoke(Native Method)
2023/02/08 09:36:14.355 : [TRACE] com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
2023/02/08 09:36:14.363 : [TRACE] com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Hi, currently i am using Dagger in my project and my BaseFragment extends DaggerFragment. However when i launch my app and launch any of my fragment i got this exception in the BaseFragment.
override fun onGetLayoutInflater(savedInstanceState: Bundle?): LayoutInflater {
val wrappedContext = ViewPumpContextWrapper.wrap(AppLocale.wrap(requireContext()))
//the exception happens in below line
return wrappedContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
}
How can solve this?
Thanks.
I have this attribute in SearchView:
android:queryHint="@string/search_hint"
he doesn't switch language
<SearchView
android:id="@+id/sw_search"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:iconifiedByDefault="false"
android:inputType="textCapSentences"
android:queryBackground="@android:color/transparent"
android:queryHint="@string/search_hint"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/quantityStringTextView" />
But,
EditText with attribute:
android:hint="@string/search_hint"
works well
Hello, Reword doesn't affect in child of RecyclerView.
It seems like AppLocale
does not affect PreferenceFragmentCompat
with setPreferencesFromResource
?
java.lang.RuntimeException: Unable to instantiate receiver com.webengage.sdk.android.WebEngageReceiver: java.lang.ClassCastException: dev.b3nedikt.app_locale.AppLocaleContextWrapper cannot be cast to android.app.ContextImpl
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4012)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7660)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassCastException: dev.b3nedikt.app_locale.AppLocaleContextWrapper cannot be cast to android.app.ContextImpl
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3996)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7660)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
hello, library doesn't work or not translate setting popup menu created with onCreateOptionsMenu.
java.lang.RuntimeException: Unable to start receiver com.evernote.android.job.patched.internal.JobBootReceiver: java.lang.ClassCastException: dev.b3nedikt.app_locale.AppLocaleContextWrapper cannot be cast to android.app.ContextImpl
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2732)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassCastException: dev.b3nedikt.app_locale.AppLocaleContextWrapper cannot be cast to android.app.ContextImpl
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2722)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I tried this with .apk file and it worked as expected. But after generating .aab file and published the app in play store locale not changing anymore.
Getting Nullpointer exception on attachBaseContext in android marshmallow
@Override protected void attachBaseContext(Context newBase) { try { super.attachBaseContext(AppLocale.wrap(newBase)); } catch (NullPointerException e) { super.attachBaseContext(newBase); } }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.