Q:

ListPreference and translation

I extends PreferenceFragment and add such code to onCreate method:
 final ListPreference pref = (ListPreference) findPreference(PREF_NAME);
 String[] array={getString(R.string.variant1), getString(R.string.variant2)};
 CharSequence[] entries = array;
 CharSequence[] entryValues = array;
 pref.setEntries(entries);
 pref.setDefaultValue(getString(R.string.variant1));
 pref.setEntryValues(entryValues);

to have two variants (they are not switch on/off, so I use ListPreference). 
So my question: from one hand I want to see in user interface suitable translation, so as you can see I used getString,
from another hand in SharedPreferences I want store value with key that not depend on user language, how can I achieve this? 

A:

EntryValues array is used as keys for items in array of entries, so those two array should be of the same size.  To the user values from entries array are shown (so they need to be translated), but in shared preferences is saved selected value from entryValues array (so they shouldn't be localized). 
In your code you can change it to something like this:
    final ListPreference pref = (ListPreference) findPreference(PREF_NAME);
    CharSequence[] entries = new String[]{getString(R.string.variant1), getString(R.string.variant2)};
    CharSequence[] entryValues = {"variant1", "variant2"};
    pref.setEntries(entries);
    pref.setDefaultValue("variant1");
    pref.setEntryValues(entryValues);

