Translation of the navbar

13 views
Skip to first unread message

Mr. Electronic

unread,
Oct 17, 2010, 12:55:51 PM10/17/10
to web2py-users
Hi

I trying to create my first web2py web site with login and because the
page will be in danish. I'm working with the languages files. The only
thing I have not been able to translate at the moment is the Welcome
in the navbar. The rest logout, login, profile, password, etc.
translates without any problems at all but I can't translate the
Welcome.

The word Welcome does not show up in the languages files, I have tried
to add the line 'Welcome':'Velkommen' but that didn't solve the
problem.

Is the Welcome missing a T('Welcome') in the auth module?

Br.
Mr. Electronic

mdipierro

unread,
Oct 17, 2010, 12:59:13 PM10/17/10
to web2py-users
did you try edit the layout and replace it with

{{=auth.navbar(prefix=T("Welcome")}}

Mr. Electronic

unread,
Oct 17, 2010, 1:03:33 PM10/17/10
to web2py-users
Hi

Thanks, that solved the problem. Still a beginner in web2py.

Br.
Mr. Electronic

Nico de Groot

unread,
Nov 22, 2010, 5:36:27 PM11/22/10
to web2py-users
A small patch in tools.py is also possible, the rest of the navbar-
function is neatly internationalized. There is a minimal downside: if
someone would call navbar with a translated string instead of T("a
greeting") as in the above suggestion this text would show up in de
language files at the LHS.

def navbar(self,prefix='Welcome',action=None):
request = self.environment.request
T = self.environment.T
if not action:
action=URL(request.application,request.controller,'user')
if prefix:
prefix = prefix.strip()+' '

change last line to

prefix = T(prefix.strip())+' '

I think the 'if' test will always be true due to the default value as
parameter.

I'll sent the patch separately

Nico

On 17 okt, 17:03, "Mr. Electronic" <r...@rc-consulting.dk> wrote:
> Hi
>
> Thanks, that solved the problem. Still a beginner in web2py.
>
> Br.
> Mr. Electronic
>
> On 17 Okt., 18:59, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
>
>
>
>
>
>
> > did you try edit the layout and replace it with
>
> > {{=auth.navbar(prefix=T("Welcome")}}
>
> > On Oct 17, 11:55 am, "Mr. Electronic" <r...@rc-consulting.dk> wrote:
>
> > > Hi
>
> > > I trying to create my first web2py web site with login and because the
> > > page will be in danish. I'm working with the languages files. The only
> > > thing I have not been able to translate at the moment is the Welcome
> > > in thenavbar. The rest logout, login, profile, password, etc.
Reply all
Reply to author
Forward
0 new messages