Yeah, that makes sense. 
Thanks Kostya.

On Monday, February 4, 2013 11:15:58 PM UTC+10, Kostya Vasilyev wrote:
>
> Editing the values / entries lists for each locale is going be error 
> prone...
>
> I'd consider a Preference subclass that works like ListPreference but 
> sorts the values and entries arrays, keeping in sync, before presenting the 
> entries list to the user.
>
> You might want to refer to the source code for ListPreference:
>
>
> https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/preference/ListPreference.java
>
> -- K
>
> On Monday, February 4, 2013 5:07:36 PM UTC+4, William Ferguson wrote:
>>
>> But that gains nothing over adding them as static lists inside the 
>> resource files.
>> It's not like I'm going to changing the names of countries on a daily 
>> basis.
>>
>> In either case I will need to construct the ordered lists for each 
>> Locale. But if I put them in a DB then I've lost visibility over 
>> localisation of those resources.
>>
>> William
>>
>>
>> On Monday, February 4, 2013 10:46:44 PM UTC+10, lbendlin wrote:
>>>
>>> As I said, I would create a SQLite table with locale, language code and 
>>> language title. Then you can do a database query that filters by the 
>>> current locale and retrieves language code and title sorted by the title.
>>>  
>>>
>>> On Sunday, February 3, 2013 5:46:45 PM UTC-5, William Ferguson wrote:
>>>
>>>> OK, I guess I mustn't have expressed myself clearly. 
>>>> I can't see how a preference is going to help here.
>>>>
>>>> I can provide an explicit ordering in each an every resource locale 
>>>> that suits that locale. But I'm wondering whether there is a programmatic 
>>>> (or other) way to ensure that the values displayed by a ListPreference are 
>>>> in alpha order for the current locale?
>>>>
>>>> William
>>>>
>>>>
>>>> On Saturday, February 2, 2013 12:50:49 PM UTC+10, lbendlin wrote: 
>>>>>
>>>>> smells like a database driven custom preference to me.
>>>>>
>>>>> On Friday, February 1, 2013 9:13:09 PM UTC-5, William Ferguson wrote: 
>>>>>>
>>>>>> What's the optimal way to ensure that the values in a ListPreference 
>>>>>> are alpha ordered according to the current locale?
>>>>>>
>>>>>> Eg if my list contains languages
>>>>>> <string-array name="language_keys">
>>>>>>    <item>cs</item>
>>>>>>   <item>da</item>
>>>>>>   <item>de</item>
>>>>>>   <item>en</item>
>>>>>>   <item>es</item>
>>>>>>   <item>fi</item>
>>>>>>  </string-array>
>>>>>>
>>>>>>  <string-array name="language_values"> <!-- English displays -->
>>>>>>    <item>Czech</item>
>>>>>>   <item>Danish</item>
>>>>>>   <item>German</item>
>>>>>>   <item>English</item>
>>>>>>   <item>Spanish</item>
>>>>>>   <item>Finnish</item>
>>>>>>  </string-array>
>>>>>>
>>>>>>  <string-array name="language_values"> <!-- German displays -->
>>>>>>   <item>Tschechisch</item>
>>>>>>   <item>Dänisch</item>
>>>>>>   <item>Deutsch</item>
>>>>>>   <item>Englisch</item>
>>>>>>   <item>Spanisch</item>
>>>>>>   <item>Finnisch</item>
>>>>>> </string-array>
>>>>>>
>>>>>> Should I replicate the keys and values in all resource locales and 
>>>>>> change their order to suit? Or is their some way that I haven't found 
>>>>>> yet 
>>>>>> where I can readily apply a sort to the ListPreference keys and values?
>>>>>>
>>>>>> William
>>>>>>
>>>>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to