On Fri, Nov 1, 2013 at 10:09 AM, Vincent Massol <[email protected]> wrote:
>
> On 01 Nov 2013, at 08:58, Thomas Mortagne <[email protected]> wrote:
>
>> That's the icon set we use in l10n wiki so yes it's a good fit but
>> note that having countries flags is one thing, matching them with
>> languages codes in another.
>
> It would be pretty easy to maintain an internal mapping (in code) between a 
> flag image name and a language code.
>
> Language codes are pretty much fixed and it should be easy to have that 
> mapping.
>
> What am I missing?

I'm planning to use this algorithm:

getCountryCode (localeString)

1. Create a Locale object from the given locale string. I need a
script service for this. I guess the best candidate is
$services.localization . I need the Locale object also in order to
display the language pretty name.
2. If the Locale object includes a country code (e.g. pt_BR) then return it
3. Lookup the language code in a map that associates a default country
code for languages that are spoken in multiple countries (like
English). This map should be pretty small, i.e. should not include
language codes that are also country codes (like FR). Basically this
map contains only language codes that are not country codes.
4. Return the language code as it is probably also the country code
(otherwise we would stop at 3.)

Thanks,
Marius

>
> Thanks
> -Vincent
>
>> An alternative is to export
>> http://l10n.xwiki.org/xwiki/bin/view/L10N/Flags page and update it
>> when we release new version like with translations.
>>
>> On Fri, Nov 1, 2013 at 8:36 AM, Marius Dumitru Florea
>> <[email protected]> wrote:
>>> Hi devs,
>>>
>>> In order to implement http://jira.xwiki.org/browse/XWIKI-9512 (display
>>> the flag icon and the language pretty name instead of the language
>>> code) I need to bundle a flag icon set in XE. The best option seems to
>>> be http://www.famfamfam.com/lab/icons/flags/ . They say:
>>>
>>> "These flag icons are available for free use for any purpose with no
>>> requirement for attribution."
>>>
>>> So if no one objects I'm going to add the PNG set to
>>> xwiki-platform-web, in webapp/resources/icons/flags . It weights about
>>> 130KB.
>>>
>>> The alternative is to display only the language pretty name, but it's
>>> less nicer.
>>>
>>> Or maybe you know a better flag icon set.
>>>
>>> Thanks,
>>> Marius
>>> _______________________________________________
>>> devs mailing list
>>> [email protected]
>>> http://lists.xwiki.org/mailman/listinfo/devs
>>
>>
>>
>> --
>> Thomas Mortagne
>> _______________________________________________
>> devs mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/devs
>
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to