0

I'm playing with webpy and have a little problem. I cannot switch between languages. Maybe my idea is wrong. I have defined the language dictionary in an external Python file.

class hello:
    def GET(self, url):
        web.header('Content-Type', 'text/html; charset=utf-8', unique=True)
        l = accept_lang(web.ctx.env)
        if l in lg.aviable:
            return lg.hu['hello']  # < here have the problem
        else:
            return lg.en["hello"]

lang.py

aviable = ['hu','en', 'de']

hu = { "hello": 'Helló Világ' }
en = { "hello": 'Hello World' }
de = { "hello": 'Hallo Welt'  }
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
vatay
  • 387
  • 2
  • 9

0 Answers0