[web2py] Re: Date display i18n internationalization?

2014-02-25 Thread Massimo Di Pierro
This is a bug. Please open a ticket.

English is not a special case, it simply is the default language. Which 
means that it assumes it does not need to check translation files for 
english. 

On Tuesday, 25 February 2014 20:33:34 UTC-6, User wrote:
>
> One minor downside to T.force(T.http_accept_language) is that when using 
> the web2py shell with models it gives an error:
>
> Traceback (most recent call last):
>   File "C:\www\web2py\gluon\restricted.py", line 217, in restricted
> exec ccode in environment
>   File "applications\my_app\models\0.py", line 6, in 
> T.force(T.http_accept_language)
>   File "C:\www\web2py\gluon\languages.py", line 661, in force
> self.accepted_language = language or self.current_languages[0]
> IndexError: list index out of range
>
>
>
>
> On Tuesday, February 25, 2014 9:09:55 PM UTC-5, User wrote:
>
>> Thanks this does work.  Most of my site visitors will be English language 
>> speakers, is there any important performance hit I should be aware of?  Why 
>> is en-us a special case?
>>
>> On Tuesday, February 25, 2014 12:46:41 AM UTC-5, Massimo Di Pierro wrote:
>>>
>>> For now do this:
>>>
>>> T.current_languages = []
>>> T.force(T.http_accept_language)
>>>
>>> This should work. I will try figure out why T.set_current_languages() 
>>> does not.
>>>
>>> On Monday, 24 February 2014 18:07:40 UTC-6, User wrote:

 This does not appear to work the string is not translated.  Also the 
 following doesn't work either:

 T.set_current_languages()
 T.force('en-us')

 However, as mentioned above changing this back to: 

 T.current_languages = []
 T.force('en-us')


 Does work


 On Monday, February 24, 2014 6:45:18 PM UTC-5, Massimo Di Pierro wrote:

> Ok. One more try:
>
> T.set_current_languages()
>
>
> On Monday, 24 February 2014 17:36:10 UTC-6, User wrote:
>>
>> I added T.current_languages = [] to the end of my model but this did 
>> nothing.  Then I tried:
>>
>> T.current_languages = []
>> T.force('en-us')
>>
>> This caused the translated string in en-us.py to show up in the 
>> rendered html (and also caused the filling of en-us.py with default 
>> strings).  However, I still don't seem to have a solution, because I 
>> don't 
>> want to force the language to be en-us.  I want to use whatever the 
>> user's 
>> accept-language is.  And in general this already works, except for 
>> en-us.  
>> Thoughts?
>>
>>
>> On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro 
>> wrote:
>>
>>> I get it now. You need:
>>>  
>>>   T.current_languages = []
>>>
>>> Otherwise this is set to
>>>
>>>   T.current_languages = ['en']
>>>
>>> and it things the current language is english and therefore it does 
>>> not need translation.
>>>
>>>
>>> On Monday, 24 February 2014 01:45:49 UTC-6, User wrote:

 In fact, if I put an entry in en-gb.py and set my browser 
 accept-language to en-gb it will correctly pick up this string, but 
 for 
 some reason it's not picking up the string in en-us (unless I'm doing 
 something wrong). 

 Also interesting to note, is when I view my site with en-gb or es 
 as the accept lang, web2py seems to automatically modify the en-gb.py 
 and 
 es.py files with default entries for every default string, whereas 
 it's not 
 doing that for en-us.py

 Does this have to with en-us.py being a default or something?

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-25 Thread User
One minor downside to T.force(T.http_accept_language) is that when using 
the web2py shell with models it gives an error:

Traceback (most recent call last):
  File "C:\www\web2py\gluon\restricted.py", line 217, in restricted
exec ccode in environment
  File "applications\my_app\models\0.py", line 6, in 
T.force(T.http_accept_language)
  File "C:\www\web2py\gluon\languages.py", line 661, in force
self.accepted_language = language or self.current_languages[0]
IndexError: list index out of range




On Tuesday, February 25, 2014 9:09:55 PM UTC-5, User wrote:

> Thanks this does work.  Most of my site visitors will be English language 
> speakers, is there any important performance hit I should be aware of?  Why 
> is en-us a special case?
>
> On Tuesday, February 25, 2014 12:46:41 AM UTC-5, Massimo Di Pierro wrote:
>>
>> For now do this:
>>
>> T.current_languages = []
>> T.force(T.http_accept_language)
>>
>> This should work. I will try figure out why T.set_current_languages() 
>> does not.
>>
>> On Monday, 24 February 2014 18:07:40 UTC-6, User wrote:
>>>
>>> This does not appear to work the string is not translated.  Also the 
>>> following doesn't work either:
>>>
>>> T.set_current_languages()
>>> T.force('en-us')
>>>
>>> However, as mentioned above changing this back to: 
>>>
>>> T.current_languages = []
>>> T.force('en-us')
>>>
>>>
>>> Does work
>>>
>>>
>>> On Monday, February 24, 2014 6:45:18 PM UTC-5, Massimo Di Pierro wrote:
>>>
 Ok. One more try:

 T.set_current_languages()


 On Monday, 24 February 2014 17:36:10 UTC-6, User wrote:
>
> I added T.current_languages = [] to the end of my model but this did 
> nothing.  Then I tried:
>
> T.current_languages = []
> T.force('en-us')
>
> This caused the translated string in en-us.py to show up in the 
> rendered html (and also caused the filling of en-us.py with default 
> strings).  However, I still don't seem to have a solution, because I 
> don't 
> want to force the language to be en-us.  I want to use whatever the 
> user's 
> accept-language is.  And in general this already works, except for en-us. 
>  
> Thoughts?
>
>
> On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote:
>
>> I get it now. You need:
>>  
>>   T.current_languages = []
>>
>> Otherwise this is set to
>>
>>   T.current_languages = ['en']
>>
>> and it things the current language is english and therefore it does 
>> not need translation.
>>
>>
>> On Monday, 24 February 2014 01:45:49 UTC-6, User wrote:
>>>
>>> In fact, if I put an entry in en-gb.py and set my browser 
>>> accept-language to en-gb it will correctly pick up this string, but for 
>>> some reason it's not picking up the string in en-us (unless I'm doing 
>>> something wrong). 
>>>
>>> Also interesting to note, is when I view my site with en-gb or es as 
>>> the accept lang, web2py seems to automatically modify the en-gb.py and 
>>> es.py files with default entries for every default string, whereas it's 
>>> not 
>>> doing that for en-us.py
>>>
>>> Does this have to with en-us.py being a default or something?
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-25 Thread User
Thanks this does work.  Most of my site visitors will be English language 
speakers, is there any important performance hit I should be aware of?  Why 
is en-us a special case?

On Tuesday, February 25, 2014 12:46:41 AM UTC-5, Massimo Di Pierro wrote:
>
> For now do this:
>
> T.current_languages = []
> T.force(T.http_accept_language)
>
> This should work. I will try figure out why T.set_current_languages() 
> does not.
>
> On Monday, 24 February 2014 18:07:40 UTC-6, User wrote:
>>
>> This does not appear to work the string is not translated.  Also the 
>> following doesn't work either:
>>
>> T.set_current_languages()
>> T.force('en-us')
>>
>> However, as mentioned above changing this back to: 
>>
>> T.current_languages = []
>> T.force('en-us')
>>
>>
>> Does work
>>
>>
>> On Monday, February 24, 2014 6:45:18 PM UTC-5, Massimo Di Pierro wrote:
>>
>>> Ok. One more try:
>>>
>>> T.set_current_languages()
>>>
>>>
>>> On Monday, 24 February 2014 17:36:10 UTC-6, User wrote:

 I added T.current_languages = [] to the end of my model but this did 
 nothing.  Then I tried:

 T.current_languages = []
 T.force('en-us')

 This caused the translated string in en-us.py to show up in the 
 rendered html (and also caused the filling of en-us.py with default 
 strings).  However, I still don't seem to have a solution, because I don't 
 want to force the language to be en-us.  I want to use whatever the user's 
 accept-language is.  And in general this already works, except for en-us.  
 Thoughts?


 On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote:

> I get it now. You need:
>  
>   T.current_languages = []
>
> Otherwise this is set to
>
>   T.current_languages = ['en']
>
> and it things the current language is english and therefore it does 
> not need translation.
>
>
> On Monday, 24 February 2014 01:45:49 UTC-6, User wrote:
>>
>> In fact, if I put an entry in en-gb.py and set my browser 
>> accept-language to en-gb it will correctly pick up this string, but for 
>> some reason it's not picking up the string in en-us (unless I'm doing 
>> something wrong). 
>>
>> Also interesting to note, is when I view my site with en-gb or es as 
>> the accept lang, web2py seems to automatically modify the en-gb.py and 
>> es.py files with default entries for every default string, whereas it's 
>> not 
>> doing that for en-us.py
>>
>> Does this have to with en-us.py being a default or something?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-24 Thread Massimo Di Pierro
For now do this:

T.current_languages = []
T.force(T.http_accept_language)

This should work. I will try figure out why T.set_current_languages() does 
not.

On Monday, 24 February 2014 18:07:40 UTC-6, User wrote:
>
> This does not appear to work the string is not translated.  Also the 
> following doesn't work either:
>
> T.set_current_languages()
> T.force('en-us')
>
> However, as mentioned above changing this back to: 
>
> T.current_languages = []
> T.force('en-us')
>
>
> Does work
>
>
> On Monday, February 24, 2014 6:45:18 PM UTC-5, Massimo Di Pierro wrote:
>
>> Ok. One more try:
>>
>> T.set_current_languages()
>>
>>
>> On Monday, 24 February 2014 17:36:10 UTC-6, User wrote:
>>>
>>> I added T.current_languages = [] to the end of my model but this did 
>>> nothing.  Then I tried:
>>>
>>> T.current_languages = []
>>> T.force('en-us')
>>>
>>> This caused the translated string in en-us.py to show up in the rendered 
>>> html (and also caused the filling of en-us.py with default strings).  
>>> However, I still don't seem to have a solution, because I don't want to 
>>> force the language to be en-us.  I want to use whatever the user's 
>>> accept-language is.  And in general this already works, except for en-us.  
>>> Thoughts?
>>>
>>>
>>> On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote:
>>>
 I get it now. You need:
  
   T.current_languages = []

 Otherwise this is set to

   T.current_languages = ['en']

 and it things the current language is english and therefore it does not 
 need translation.


 On Monday, 24 February 2014 01:45:49 UTC-6, User wrote:
>
> In fact, if I put an entry in en-gb.py and set my browser 
> accept-language to en-gb it will correctly pick up this string, but for 
> some reason it's not picking up the string in en-us (unless I'm doing 
> something wrong). 
>
> Also interesting to note, is when I view my site with en-gb or es as 
> the accept lang, web2py seems to automatically modify the en-gb.py and 
> es.py files with default entries for every default string, whereas it's 
> not 
> doing that for en-us.py
>
> Does this have to with en-us.py being a default or something?
>


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-24 Thread User
This does not appear to work the string is not translated.  Also the 
following doesn't work either:

T.set_current_languages()
T.force('en-us')

However, as mentioned above changing this back to: 

T.current_languages = []
T.force('en-us')


Does work


On Monday, February 24, 2014 6:45:18 PM UTC-5, Massimo Di Pierro wrote:

> Ok. One more try:
>
> T.set_current_languages()
>
>
> On Monday, 24 February 2014 17:36:10 UTC-6, User wrote:
>>
>> I added T.current_languages = [] to the end of my model but this did 
>> nothing.  Then I tried:
>>
>> T.current_languages = []
>> T.force('en-us')
>>
>> This caused the translated string in en-us.py to show up in the rendered 
>> html (and also caused the filling of en-us.py with default strings).  
>> However, I still don't seem to have a solution, because I don't want to 
>> force the language to be en-us.  I want to use whatever the user's 
>> accept-language is.  And in general this already works, except for en-us.  
>> Thoughts?
>>
>>
>> On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote:
>>
>>> I get it now. You need:
>>>  
>>>   T.current_languages = []
>>>
>>> Otherwise this is set to
>>>
>>>   T.current_languages = ['en']
>>>
>>> and it things the current language is english and therefore it does not 
>>> need translation.
>>>
>>>
>>> On Monday, 24 February 2014 01:45:49 UTC-6, User wrote:

 In fact, if I put an entry in en-gb.py and set my browser 
 accept-language to en-gb it will correctly pick up this string, but for 
 some reason it's not picking up the string in en-us (unless I'm doing 
 something wrong). 

 Also interesting to note, is when I view my site with en-gb or es as 
 the accept lang, web2py seems to automatically modify the en-gb.py and 
 es.py files with default entries for every default string, whereas it's 
 not 
 doing that for en-us.py

 Does this have to with en-us.py being a default or something?

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-24 Thread Massimo Di Pierro
Ok. One more try:

T.set_current_languages()


On Monday, 24 February 2014 17:36:10 UTC-6, User wrote:
>
> I added T.current_languages = [] to the end of my model but this did 
> nothing.  Then I tried:
>
> T.current_languages = []
> T.force('en-us')
>
> This caused the translated string in en-us.py to show up in the rendered 
> html (and also caused the filling of en-us.py with default strings).  
> However, I still don't seem to have a solution, because I don't want to 
> force the language to be en-us.  I want to use whatever the user's 
> accept-language is.  And in general this already works, except for en-us.  
> Thoughts?
>
>
> On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote:
>
>> I get it now. You need:
>>  
>>   T.current_languages = []
>>
>> Otherwise this is set to
>>
>>   T.current_languages = ['en']
>>
>> and it things the current language is english and therefore it does not 
>> need translation.
>>
>>
>> On Monday, 24 February 2014 01:45:49 UTC-6, User wrote:
>>>
>>> In fact, if I put an entry in en-gb.py and set my browser 
>>> accept-language to en-gb it will correctly pick up this string, but for 
>>> some reason it's not picking up the string in en-us (unless I'm doing 
>>> something wrong). 
>>>
>>> Also interesting to note, is when I view my site with en-gb or es as the 
>>> accept lang, web2py seems to automatically modify the en-gb.py and 
>>> es.py files with default entries for every default string, whereas it's not 
>>> doing that for en-us.py
>>>
>>> Does this have to with en-us.py being a default or something?
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-24 Thread User
I added T.current_languages = [] to the end of my model but this did 
nothing.  Then I tried:

T.current_languages = []
T.force('en-us')

This caused the translated string in en-us.py to show up in the rendered 
html (and also caused the filling of en-us.py with default strings).  
However, I still don't seem to have a solution, because I don't want to 
force the language to be en-us.  I want to use whatever the user's 
accept-language is.  And in general this already works, except for en-us.  
Thoughts?


On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote:

> I get it now. You need:
>  
>   T.current_languages = []
>
> Otherwise this is set to
>
>   T.current_languages = ['en']
>
> and it things the current language is english and therefore it does not 
> need translation.
>
>
> On Monday, 24 February 2014 01:45:49 UTC-6, User wrote:
>>
>> In fact, if I put an entry in en-gb.py and set my browser accept-language 
>> to en-gb it will correctly pick up this string, but for some reason it's 
>> not picking up the string in en-us (unless I'm doing something wrong). 
>>
>> Also interesting to note, is when I view my site with en-gb or es as the 
>> accept lang, web2py seems to automatically modify the en-gb.py and 
>> es.py files with default entries for every default string, whereas it's not 
>> doing that for en-us.py
>>
>> Does this have to with en-us.py being a default or something?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-24 Thread Massimo Di Pierro
I get it now. You need:
 
  T.current_languages = []

Otherwise this is set to

  T.current_languages = ['en']

and it things the current language is english and therefore it does not 
need translation.


On Monday, 24 February 2014 01:45:49 UTC-6, User wrote:
>
> In fact, if I put an entry in en-gb.py and set my browser accept-language 
> to en-gb it will correctly pick up this string, but for some reason it's 
> not picking up the string in en-us (unless I'm doing something wrong). 
>
> Also interesting to note, is when I view my site with en-gb or es as the 
> accept lang, web2py seems to automatically modify the en-gb.py and 
> es.py files with default entries for every default string, whereas it's not 
> doing that for en-us.py
>
> Does this have to with en-us.py being a default or something?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-23 Thread User
In fact, it put an entry in en-gb.py and set my browser accept to en-gb it 
will correctly pick up this string, but for some reason it's not picking up 
the string in en-us (unless I'm doing something wrong). 

Also interesting to note, is when I view in en-gb or es, web2py seems to 
automatically modify those files with default entries for every default 
string, whereas it's not doing that for en-us.py

Does this have to with en-us.py being a default or something?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-23 Thread User
To clarify further, I made an entry in languages/es.py and when I set my 
browser preferred language to "es" I get the entry I put in the es.py 
file.  So translation is working.  However, when I set my browser to en-us 
it does not seem to pick up the entry in en-us.py file

On Monday, February 24, 2014 2:13:04 AM UTC-5, User wrote:
>
> Also I tried in web2py shell:
>
>  str(T('this-is-a-test', language='en-us'))
>
> which returns:
>
> 'this-is-a-test'
>
> Not sure if this makes any sense calling from the shell but figured I try 
> it.
>
> On Monday, February 24, 2014 2:02:25 AM UTC-5, User wrote:
>
>> This in layout.html.  Viewing the rendered source in the browser the 
>> output is
>>
>> var dateFormat = "dd mmm ";
>>
>> Putting T.force('en-us') at the end of models/models.py didn't change 
>> anything.
>>
>> In fact, to take javascript out of the picture I just put a simple T 
>> statement in the footer of my layout.html:
>>
>> {{=T('this-is-a-test')}}
>>
>> And added an entry for it in en-us.py
>>
>> {
>> '!langcode!': 'en-us',
>> '!langname!': 'English (United States)',
>> 'dd mmm ':'mmm dd, ',
>> 'this-is-a-test': 'PASS'
>> }
>>
>>
>> The output remains: this-is-a-test
>>
>> I can easily insert an debug breakpoint: import ipdb; ipdb.set_trace() if 
>> that will help examine anything.
>>
>>
>>
>> On Monday, February 24, 2014 1:27:10 AM UTC-5, Massimo Di Pierro wrote:
>>
>>> This should work. I do not think the problem is in T. Anyway, let's rule 
>>> that out.
>>>
>>> Where is this, in a HTML file?
>>>
>>> When you look at the source file, is the string "{{=T('dd mmm ')}}"
>>> ) translated?
>>> What if you add the following to your model?
>>>
>>> T.force('en-us')
>>>
>>>
>>>
>>>
>>> On Sunday, 23 February 2014 23:08:14 UTC-6, User wrote:

 Sorry I'm not following the relevance of that forum topic.  What I'm 
 trying to do for example is:

 I have a date in javascript in a view :

 var dateFormat = "{{=T('dd mmm ')}}")


 Later on this will get expanded to for example "20 January 2014".  This 
 works and the date display as expected.  For the US, I want the date 
 displayed as "January 20, 2014". So I created a en-us.py language file 
 with 
 the following content:

 {
 '!langcode!': 'en-us',
 '!langname!': 'English (United States)',
 'dd mmm ':'mmm dd, '
 }


 I restarted web2py.  However, with my browser Accept-Language set to 
 en-us I still see the date as "20 January 2014".  My full firefox header 
 is:
 Accept-Language en-us,en;q=0.5

 What am I missing about how T works?


 On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote:

> https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ
>
> On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote:
>>
>> I have some dates that I want to display in the proper culture 
>> specific format.  I want a simple solution so what I want is rather than 
>> me 
>> having to specify the date format for every possible culture is to use 
>> the 
>> following default:
>>
>> dd-mm-
>>
>> and then specify a handful of exceptions, e.g. for United States:
>>
>> mm-dd- 
>>
>> How can I achieve this in web2py where it's switched based on the 
>> Accept-Language header?
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-23 Thread User
Also I tried in web2py shell:

 str(T('this-is-a-test', language='en-us'))

which returns:

'this-is-a-test'

Not sure if this makes any sense calling from the shell but figured I try 
it.

On Monday, February 24, 2014 2:02:25 AM UTC-5, User wrote:

> This in layout.html.  Viewing the rendered source in the browser the 
> output is
>
> var dateFormat = "dd mmm ";
>
> Putting T.force('en-us') at the end of models/models.py didn't change 
> anything.
>
> In fact, to take javascript out of the picture I just put a simple T 
> statement in the footer of my layout.html:
>
> {{=T('this-is-a-test')}}
>
> And added an entry for it in en-us.py
>
> {
> '!langcode!': 'en-us',
> '!langname!': 'English (United States)',
> 'dd mmm ':'mmm dd, ',
> 'this-is-a-test': 'PASS'
> }
>
>
> The output remains: this-is-a-test
>
> I can easily insert an debug breakpoint: import ipdb; ipdb.set_trace() if 
> that will help examine anything.
>
>
>
> On Monday, February 24, 2014 1:27:10 AM UTC-5, Massimo Di Pierro wrote:
>
>> This should work. I do not think the problem is in T. Anyway, let's rule 
>> that out.
>>
>> Where is this, in a HTML file?
>>
>> When you look at the source file, is the string "{{=T('dd mmm ')}}") 
>> translated?
>> What if you add the following to your model?
>>
>> T.force('en-us')
>>
>>
>>
>>
>> On Sunday, 23 February 2014 23:08:14 UTC-6, User wrote:
>>>
>>> Sorry I'm not following the relevance of that forum topic.  What I'm 
>>> trying to do for example is:
>>>
>>> I have a date in javascript in a view :
>>>
>>> var dateFormat = "{{=T('dd mmm ')}}")
>>>
>>>
>>> Later on this will get expanded to for example "20 January 2014".  This 
>>> works and the date display as expected.  For the US, I want the date 
>>> displayed as "January 20, 2014". So I created a en-us.py language file with 
>>> the following content:
>>>
>>> {
>>> '!langcode!': 'en-us',
>>> '!langname!': 'English (United States)',
>>> 'dd mmm ':'mmm dd, '
>>> }
>>>
>>>
>>> I restarted web2py.  However, with my browser Accept-Language set to 
>>> en-us I still see the date as "20 January 2014".  My full firefox header is:
>>> Accept-Language en-us,en;q=0.5
>>>
>>> What am I missing about how T works?
>>>
>>>
>>> On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote:
>>>
 https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ

 On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote:
>
> I have some dates that I want to display in the proper culture 
> specific format.  I want a simple solution so what I want is rather than 
> me 
> having to specify the date format for every possible culture is to use 
> the 
> following default:
>
> dd-mm-
>
> and then specify a handful of exceptions, e.g. for United States:
>
> mm-dd- 
>
> How can I achieve this in web2py where it's switched based on the 
> Accept-Language header?
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-23 Thread User
This in layout.html.  Viewing the rendered source in the browser the output 
is

var dateFormat = "dd mmm ";

Putting T.force('en-us') at the end of models/models.py didn't not change 
anything.

In fact, to take javascript out of the picture I just put a simple T 
statement in the footer of my layout.html:

{{=T('this-is-a-test')}}

And added an entry for it in en-us.py

{
'!langcode!': 'en-us',
'!langname!': 'English (United States)',
'dd mmm ':'mmm dd, ',
'this-is-a-test': 'PASS'
}


The output remains: this-is-a-test

I can easily insert an debug breakpoint: import ipdb; ipdb.set_trace() if 
that will help examine anything.



On Monday, February 24, 2014 1:27:10 AM UTC-5, Massimo Di Pierro wrote:

> This should work. I do not think the problem is in T. Anyway, let's rule 
> that out.
>
> Where is this, in a HTML file?
>
> When you look at the source file, is the string "{{=T('dd mmm ')}}") 
> translated?
> What if you add the following to your model?
>
> T.force('en-us')
>
>
>
>
> On Sunday, 23 February 2014 23:08:14 UTC-6, User wrote:
>>
>> Sorry I'm not following the relevance of that forum topic.  What I'm 
>> trying to do for example is:
>>
>> I have a date in javascript in a view :
>>
>> var dateFormat = "{{=T('dd mmm ')}}")
>>
>>
>> Later on this will get expanded to for example "20 January 2014".  This 
>> works and the date display as expected.  For the US, I want the date 
>> displayed as "January 20, 2014". So I created a en-us.py language file with 
>> the following content:
>>
>> {
>> '!langcode!': 'en-us',
>> '!langname!': 'English (United States)',
>> 'dd mmm ':'mmm dd, '
>> }
>>
>>
>> I restarted web2py.  However, with my browser Accept-Language set to 
>> en-us I still see the date as "20 January 2014".  My full firefox header is:
>> Accept-Language en-us,en;q=0.5
>>
>> What am I missing about how T works?
>>
>>
>> On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote:
>>
>>> https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ
>>>
>>> On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote:

 I have some dates that I want to display in the proper culture specific 
 format.  I want a simple solution so what I want is rather than me having 
 to specify the date format for every possible culture is to use the 
 following default:

 dd-mm-

 and then specify a handful of exceptions, e.g. for United States:

 mm-dd- 

 How can I achieve this in web2py where it's switched based on the 
 Accept-Language header?




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-23 Thread Massimo Di Pierro
This should work. I do not think the problem is in T. Anyway, let's rule 
that out.

Where is this, in a HTML file?

When you look at the source file, is the string "{{=T('dd mmm ')}}") 
translated?
What if you add the following to your model?

T.force('en-us')




On Sunday, 23 February 2014 23:08:14 UTC-6, User wrote:
>
> Sorry I'm not following the relevance of that forum topic.  What I'm 
> trying to do for example is:
>
> I have a date in javascript in a view :
>
> var dateFormat = "{{=T('dd mmm ')}}")
>
>
> Later on this will get expanded to for example "20 January 2014".  This 
> works and the date display as expected.  For the US, I want the date 
> displayed as "January 20, 2014". So I created a en-us.py language file with 
> the following content:
>
> {
> '!langcode!': 'en-us',
> '!langname!': 'English (United States)',
> 'dd mmm ':'mmm dd, '
> }
>
>
> I restarted web2py.  However, with my browser Accept-Language set to en-us 
> I still see the date as "20 January 2014".  My full firefox header is:
> Accept-Language en-us,en;q=0.5
>
> What am I missing about how T works?
>
>
> On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote:
>
>> https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ
>>
>> On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote:
>>>
>>> I have some dates that I want to display in the proper culture specific 
>>> format.  I want a simple solution so what I want is rather than me having 
>>> to specify the date format for every possible culture is to use the 
>>> following default:
>>>
>>> dd-mm-
>>>
>>> and then specify a handful of exceptions, e.g. for United States:
>>>
>>> mm-dd- 
>>>
>>> How can I achieve this in web2py where it's switched based on the 
>>> Accept-Language header?
>>>
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-23 Thread User
Sorry I'm not following the relevance of that forum topic.  What I'm trying 
to do for example is:

I have a date in javascript in a view :

var dateFormat = "{{=T('dd mmm ')}}")


Later on this will get expanded to for example "20 January 2014".  For the 
US, I want the date displayed as "January 20, 2014". So I created a 
en-us.py language file with the following content:

{
'!langcode!': 'en-us',
'!langname!': 'English (United States)',
'dd mmm ':'mmm dd, '
}


I restarted web2py.  However with my browser Accept-Language set to en-us I 
still see the date as "20 January 2014".  My full firefox header is:
Accept-Language en-us,en;q=0.5

What am I missing about how T works?


On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote:

> https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ
>
> On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote:
>>
>> I have some dates that I want to display in the proper culture specific 
>> format.  I want a simple solution so what I want is rather than me having 
>> to specify the date format for every possible culture is to use the 
>> following default:
>>
>> dd-mm-
>>
>> and then specify a handful of exceptions, e.g. for United States:
>>
>> mm-dd- 
>>
>> How can I achieve this in web2py where it's switched based on the 
>> Accept-Language header?
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Date display i18n internationalization?

2014-02-23 Thread Massimo Di Pierro
https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ

On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote:
>
> I have some dates that I want to display in the proper culture specific 
> format.  I want a simple solution so what I want is rather than me having 
> to specify the date format for every possible culture is to use the 
> following default:
>
> dd-mm-
>
> and then specify a handful of exceptions, e.g. for United States:
>
> mm-dd- 
>
> How can I achieve this in web2py where it's switched based on the 
> Accept-Language header?
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.