Re: [A&E] Last Call comments (2): discovery & localization

On Sep 23, 2009, at 16:07 , Marcos Caceres wrote:
> Robin Berjon wrote:
>> On Sep 21, 2009, at 20:08 , Marcos Caceres wrote:
>>>> 5.1
>>>>
>>>> Localization
>>>>
>>>> Shall it be possible for the widget to programmatically discover  
>>>> the
>>>> localization path it was loaded from (section 9 of P&C)?
>>>
>>> Yes, you can check its URI. If the implementation supports the  
>>> window
>>> object, then it possible.
>>
>> How? window.location will return widget:///foo.html irrespective of
>> whether the runtime loaded /foo.html or /locales/fr/foo.html.
>
> Ah, ok. Yes, forgot about that. Well, the best we can do is give the  
> lang list that the UA is using? Ideas? is this really important? I  
> can see it being useful to know where stuff is being loaded from  
> instead of having to guess where a resource was loaded from.

I wouldn't call it important enough that it would have to happen in  
v1. Basic functionality would be to expose the UA's known preferred  
locales, but I don't think that's for us to define (it seems like a  
perfect candidate for the navigator object). If you want to make it  
useful in our model you need to be able to find the locale of a given  
resource, which in turn requires a uriToLocale() method.

I think that it's a lot of work for something that won't be used  
(though of course that could be said of pretty much the entire locale  
system :~).

Maybe in v2 we can improve this (e.g. also with a setLocale() call so  
widgets can expose a UI to change language) but for the time being I'd  
recommend not doing it — the cost-benefit ratio isn't worth it and we  
shouldn't do something just for completeness' sake, we're not in the  
elegance business.

-- 
Robin Berjon - http://berjon.com/

Received on Thursday, 24 September 2009 10:28:31 UTC