Don't you try ti access attribute 'year' of your prettydated expire_date 
somewhere in your code?

On Sunday, July 12, 2015 at 12:10:09 PM UTC+3, icodk wrote:
>
> Thanks Maxim,
> I tried :
> db.place.expire_date.represent= lambda value,row: prettydate(value,T=T)
> The problem is that I get the following error
> <type 'exceptions.AttributeError'> 'str' object has no attribute 'year'
> The field is defined as:
>
> Field('expire_date','datetime',label=T('expire_date'),writable=False,default=request.now)
> If I don't add the T=T it works fine (but not translate:-(
>
>
> On Saturday, July 11, 2015 at 3:24:03 PM UTC+2, Maxim Hrustalev wrote:
>>
>> To translate prettydate output  you have to pass translation function as 
>> argument: prettydate(my_date, T=T).
>>
>> On Wednesday, July 8, 2015 at 12:40:55 AM UTC+3, icodk wrote:
>>>
>>> Thanks for your help.
>>> My editor (web2py web interface, Notepad++,Visual Studio) should be able 
>>> to find 'ago' in any sentence combination. It also found '%d weeks ago' 
>>> as I wrote below so I can't see any reason why it should not find  "%d 
>>> hours ago" unless it is not there. May be I am looking in the wrong 
>>> file-but everything else works fine(I mean the other translations).
>>>
>>>
>>> On Monday, July 6, 2015 at 8:10:39 AM UTC+2, xmarx wrote:
>>>>
>>>> you must look up the "%d weeks ago", "%d hours ago", "%d months ago" 
>>>> phrases. 
>>>> not just "ago". because i think item that be translated is T("%d days 
>>>> ago"). not T("ago"). i don't know its detail.
>>>>
>>>>  In addition I can only find '%d weeks ago': '%d uge siden', in my 
>>>>> language file.
>>>>
>>>>
>>>> this translate  used to be work. didn't it?
>>>>
>>>> 2015-07-05 1:49 GMT+03:00 icodk <i...@alpiron.com>:
>>>>
>>>>> There are two issues here, the first is that 'ago' it is NOT in my 
>>>>> language file and if you look in  gluon/tools.py you will see that 
>>>>> suffix = ' ago ' and NOT  suffix = T(' ago') . Anyway this is in my 
>>>>>  gluon/tools.py file.
>>>>> OK I replaced  it with:  suffix = T(' ago') .which should be part of 
>>>>> the web2py in the first place or I am missing something.
>>>>>
>>>>> The second issue is that even if I replaced it as above I still can't 
>>>>> find 'ago' in my language file. In addition I can only find '%d weeks 
>>>>> ago': '%d uge siden', in my language file. Nothing else from prettydate 
>>>>> function in my language file.
>>>>> What am I doing wrong ?
>>>>> Thanks
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Saturday, July 4, 2015 at 1:45:24 PM UTC+2, icodk wrote:
>>>>>>
>>>>>> Is there any reason why the 'ago' is not translate in 
>>>>>> prettydate  (gluon/tools.py) ?
>>>>>>
>>>>>> *suffix = ' ago'* instead of:
>>>>>> *suffix = ** T(" ago")*
>>>>>>
>>>>>> In Danish that will be translated to: 'siden'
>>>>>> Also I can't find the other strings in my language file
>>>>>> T('1 year' + suffix)
>>>>>> T('1 month' + suffix)
>>>>>> etc.
>>>>>>
>>>>>> I can only find:
>>>>>> %d weeks ago
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>  -- 
>>>>> 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+un...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> Selman Kocael
>>>> İsabet Yayınları
>>>>
>>>> 

-- 
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/d/optout.

Reply via email to