Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Updating Locale config for PluginAPK resources is not working #8

Open
@gabriel-rajadurai

Description

I wanted to check how localization would work with plugins, but ran into an issue.

What I have is a LocaleHelper class,

object LocaleHelper {
 @JvmStatic
 fun onAttach(context: Context): Context {
 val chinese = Locale.CHINESE
 val locale = Locale(chinese.language, chinese.country)
 Locale.setDefault(locale)
 val configuration =
 context.resources.configuration
 configuration.setLocale(locale)
 configuration.setLayoutDirection(locale)
 return context.createConfigurationContext(configuration)
 }
}

I use this class with the plugin context mContext that is created in the BaseActivity.

LocaleHelper.onAttach(mContext).getString(R.string.localized_text)

I have added this localized_text string resource for both English and Chinese. But on running this, it prints some random text.

I tried this with the pluginApk sample app and it printed "sans-serif-medium", which is just weird.

A solution for this would be really helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /