Example #1
0
File: mainweb.py Project: sup6/pali
def commonTemplateValues(urlLocale, userLocale):
    i18n.setLocale(userLocale)
    template_values = {
        #    'serverEnv': 'ec2',
        #    'dicWebAppUrl': 'http://dictionary.sutta.org/',
        'serverEnv':
        'appspot',
        'tpkWebAppUrl':
        'http://epalitipitaka.appspot.com/',
        'dicWebAppUrl':
        'http://palidictionary.appspot.com/',
        #    'tpkWebAppUrl': 'http://tipitaka.online-dhamma.net/',
        #    'dicWebAppUrl': 'http://dictionary.online-dhamma.net/',
        'htmlTitle':
        u'',
        'userLocale':
        userLocale,
        'locales':
        json.dumps(i18n.locales),
        'localeLanguageMapping':
        json.dumps(i18n.localeLanguageMapping),
        'langQs':
        json.dumps(parseAcceptLanguage(
            web.ctx.env.get('HTTP_ACCEPT_LANGUAGE'))),
        'urlLocale':
        urlLocale,
        'isTrack':
        isTrack(web.input(track=None).track),
        'isDevServer':
        isDevServer(),
    }
    return template_values
Example #2
0
def getCommonTemplateValues(self, urlLocale, userLocale):
  i18n.setLocale(userLocale)
  template_values = {
    'htmlTitle': u'',
    'userLocale': userLocale,
    'langQs': json.dumps(parseAcceptLanguage(self.request.headers.get('accept_language'))),
    'urlLocale': urlLocale,
    'isTrack': isTrack(self.request.GET.get('track')),
    'isDevServer': isDevServer(),
  }

  return template_values
Example #3
0
def getCommonTemplateValues(self, urlLocale, prefix=None, word=None):
  userLocale = getLocale(urlLocale, self.request.headers.get('accept_language'))
  i18n.setLocale(userLocale)
  template_values = {
    'htmlTitle': getHtmlTitle(userLocale, self.__class__.__name__, i18n, prefix, word),
    'userLocale': userLocale,
    'langQs': json.dumps(parseAcceptLanguage(self.request.headers.get('accept_language'))),
    'urlLocale': urlLocale,
    'isTrack': isTrack(self.request.GET.get('track')),
    'isDevServer': isDevServer(),
  }

  return template_values
Example #4
0
def commonTemplateValues(urlLocale, userLocale):
  i18n.setLocale(userLocale)
  template_values = {
#    'serverEnv': 'ec2',
#    'dicWebAppUrl': 'http://dictionary.sutta.org/',
    'serverEnv': 'appspot',
#    'dicWebAppUrl': 'http://palidictionary.appspot.com/',
    'dicWebAppUrl': 'http://dictionary.online-dhamma.net/',
    'htmlTitle': u'',
    'userLocale': userLocale,
    'langQs': json.dumps(parseAcceptLanguage(web.ctx.env.get('HTTP_ACCEPT_LANGUAGE'))),
    'urlLocale': urlLocale,
    'isTrack': isTrack(web.input(track=None).track),
    'isDevServer': isDevServer(),
  }
  return template_values
Example #5
0
def commonTemplateValues(urlLocale, reqHandlerName, prefix=None, word=None):
  userLocale = getLocale(urlLocale, web.ctx.env.get('HTTP_ACCEPT_LANGUAGE'))
  i18n.setLocale(userLocale)
  template_values = {
#    'serverEnv': 'ec2',
#    'tpkWebAppUrl': 'http://tipitaka.sutta.org/',
    'serverEnv': 'appspot',
#    'tpkWebAppUrl': 'http://epalitipitaka.appspot.com/',
    'tpkWebAppUrl': 'http://tipitaka.online-dhamma.net/',
    'htmlTitle': getHtmlTitle(userLocale, reqHandlerName, i18n, prefix, word),
    'userLocale': userLocale,
    'langQs': json.dumps(parseAcceptLanguage(web.ctx.env.get('HTTP_ACCEPT_LANGUAGE'))),
    'urlLocale': urlLocale,
    'isTrack': isTrack(web.input(track=None).track),
    'isDevServer': isDevServer(),
  }
  return template_values
Example #6
0
def getCommonTemplateValues(self, urlLocale, userLocale):
    i18n.setLocale(userLocale)
    template_values = {
        'htmlTitle':
        u'',
        'userLocale':
        userLocale,
        'langQs':
        json.dumps(
            parseAcceptLanguage(self.request.headers.get('accept_language'))),
        'urlLocale':
        urlLocale,
        'isTrack':
        isTrack(self.request.GET.get('track')),
        'isDevServer':
        isDevServer(),
    }

    return template_values
Example #7
0
def commonTemplateValues(urlLocale, userLocale):
    i18n.setLocale(userLocale)
    template_values = {
        #    'serverEnv': 'ec2',
        #    'dicWebAppUrl': 'http://dictionary.sutta.org/',
        "serverEnv": "appspot",
        "tpkWebAppUrl": "http://epalitipitaka.appspot.com/",
        "dicWebAppUrl": "http://palidictionary.appspot.com/",
        #    'tpkWebAppUrl': 'http://tipitaka.online-dhamma.net/',
        #    'dicWebAppUrl': 'http://dictionary.online-dhamma.net/',
        "htmlTitle": u"",
        "userLocale": userLocale,
        "locales": json.dumps(i18n.locales),
        "localeLanguageMapping": json.dumps(i18n.localeLanguageMapping),
        "langQs": json.dumps(parseAcceptLanguage(web.ctx.env.get("HTTP_ACCEPT_LANGUAGE"))),
        "urlLocale": urlLocale,
        "isTrack": isTrack(web.input(track=None).track),
        "isDevServer": isDevServer(),
    }
    return template_values
Example #8
0
def getCommonTemplateValues(self, urlLocale, prefix=None, word=None):
    userLocale = getLocale(urlLocale,
                           self.request.headers.get('accept_language'))
    i18n.setLocale(userLocale)
    template_values = {
        'htmlTitle':
        getHtmlTitle(userLocale, self.__class__.__name__, i18n, prefix, word),
        'userLocale':
        userLocale,
        'langQs':
        json.dumps(
            parseAcceptLanguage(self.request.headers.get('accept_language'))),
        'urlLocale':
        urlLocale,
        'isTrack':
        isTrack(self.request.GET.get('track')),
        'isDevServer':
        isDevServer(),
    }

    return template_values