Hello all. I've put on line my first web2py website, thanks to all for help. It's native in English, with Italian translation. So I've got things like that:
Controller: def products(): ... response.title = 'My web site' + ' -' + T('Products') ... And in my views I load text from db like that: ... {{if T.accepted_language=='it':}} {{=(category.description_it)}} {{else:}} {{=(category.description_en)}} {{pass}} ... The problem seems to be that search engines take care only about English pages, and not Italian ones. Perhaps it's normal, URL don't change if page is displayed in English or Italian. Certainly I have to set language in routers.py for having different URL's depending of languages. I've tried like that but I obtain always en in my URL, also if I display pages in Italian: mydomain.com/en/products I don't have /it/ also with the it language. routers = dict( BASE = dict( domains = { "mydomain.com" : "myapp", } ), myapp = dict( languages=['en', 'it'], default_language=None ), ) Here is how I manage language selection in menu: In layout.html I append the language menu: ... {{if response.menu:}} {{if session.language is None:}} {{session.language == T.accepted_language}} {{pass}} {{if session.language == 'it' or T.accepted_language == 'it':}} {{response.menu.append(('IT', False, URL('default', 'it'), [('EN', False, URL('default', 'en'), [])]))}} {{else:}} {{response.menu.append(('EN', False, URL('default', 'en'), [('IT', False, URL('default', 'it'), [])]))}} {{pass}} {{=MENU(response.menu, _class='nav',li_class='dropdown',ul_class= 'dropdown-menu')}} {{pass}} ... In controller: def it(): session.language = 'it' if request.env.http_referer: redirect(request.env.http_referer) else: redirect(URL('index')) return dict() def en(): session.language = 'en-us' if request.env.http_referer: redirect(request.env.http_referer) else: redirect(URL('index')) return dict() And in controller for every view at the beginning of functions I set my session.language variable: def products(): if session.language: T.force(session.language) ... 1/ How can I have /it/ instead of /en/ with Italian pages ? 2/ If I use a tool like that http://www.seoutility.com/it/tools/google/sitemap_generator.aspx does for sitemap.xml generation it will find also Italian pages ? Thanks, regards. -- 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.