Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb573418 authored by Mattias Falk's avatar Mattias Falk Committed by Johan Redestig
Browse files

Re-read shortcut labels if the language has changed

The shortcut label isn't updated to the current language
if the phone's language has changed.

The problem was that the shortcut label is stored in a
static variable which is set once and kept throughout the
life time of the process.

Change-Id: I89c5875fbf28fb82e073166c472ca205d28674fb
parent 4299f63e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ public final class MenuItemImpl implements MenuItem {
     */ 
    private ContextMenuInfo mMenuInfo;
    
    private static String sLanguage;
    private static String sPrependShortcutLabel;
    private static String sEnterShortcutLabel;
    private static String sDeleteShortcutLabel;
@@ -114,7 +115,9 @@ public final class MenuItemImpl implements MenuItem {
    MenuItemImpl(MenuBuilder menu, int group, int id, int categoryOrder, int ordering,
            CharSequence title, int showAsAction) {

        if (sPrependShortcutLabel == null) {
        String lang = menu.getContext().getResources().getConfiguration().locale.toString();
        if (sPrependShortcutLabel == null || !lang.equals(sLanguage)) {
            sLanguage = lang;
            // This is instantiated from the UI thread, so no chance of sync issues 
            sPrependShortcutLabel = menu.getContext().getResources().getString(
                    com.android.internal.R.string.prepend_shortcut_label);