Warning: Can't use blame annotator:
svn blame failed on branches/LCSv2/routes.example.py: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator/branches/LCSv2/routes.example.py @ 619

Revision 619, 2.3 KB checked in by jdalbey, 6 years ago (diff)

Add branch LCSv2

RevLine 
1# -*- coding: utf-8 -*-
2
3# ----------------------------------------------------------------------------------------------------------------------
4#  This is an app-specific example router
5#
6#  This simple router is used for setting languages from app/languages directory
7#  as a part of the application path:  app/<lang>/controller/function
8#  Language from default.py or 'en' (if the file is not found) is used as
9#  a default_language
10#
11# See <web2py-root-dir>/examples/routes.parametric.example.py for parameter's detail
12# ----------------------------------------------------------------------------------------------------------------------
13
14# ----------------------------------------------------------------------------------------------------------------------
15# To enable this route file you must do the steps:
16# 1. rename <web2py-root-dir>/examples/routes.parametric.example.py to routes.py
17# 2. rename this APP/routes.example.py to APP/routes.py (where APP - is your application directory)
18# 3. restart web2py (or reload routes in web2py admin interface)
19#
20# YOU CAN COPY THIS FILE TO ANY APPLICATION'S ROOT DIRECTORY WITHOUT CHANGES!
21# ----------------------------------------------------------------------------------------------------------------------
22
23from gluon.fileutils import abspath
24from gluon.languages import read_possible_languages
25
26possible_languages = read_possible_languages(abspath('applications', app))
27# ----------------------------------------------------------------------------------------------------------------------
28# NOTE! app - is an application based router's parameter with name of an application. E.g.'welcome'
29# ----------------------------------------------------------------------------------------------------------------------
30
31routers = {
32    app: dict(
33        default_language=possible_languages['default'][0],
34        languages=[lang for lang in possible_languages if lang != 'default']
35    )
36}
37
38# ----------------------------------------------------------------------------------------------------------------------
39# NOTE! To change language in your application using these rules add this line in one of your models files:
40# ----------------------------------------------------------------------------------------------------------------------
41#   if request.uri_language: T.force(request.uri_language)
Note: See TracBrowser for help on using the repository browser.