Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1228 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

i18n and kid: not functional

Reported by: jtate Owned by: faide
Priority: high Milestone: 1.0.3
Component: tg-admin (non-toolbox) Version: 1.0
Severity: minor Keywords:
Cc:

Description

First bug: the command line tools cannot generate the .mo files for the templates, just the .py files with _() around strings. Only the web interface seems to do it for kid templates.

Second bug: After translating a kid template according to  http://docs.turbogears.org/1.0/Internationalization , and setting the settings specified, no language other than english is rendered.

Change History

comment:1 in reply to: ↑ description Changed 12 years ago by qk

Second bug: After translating a kid template according to  http://docs.turbogears.org/1.0/Internationalization , and setting the settings specified, no language other than english is rendered.

Hi,

I found that config.get("i18n.run_template_filter") always returns None. There is a problem with reading some vars from dev.cfg (this problem doesn't exist with for ex. "server.socket_port" option).

My workaround is to add:

from turbogears.util import load_project_config
load_project_config()

in turbogears/view/base.py. After that - config.get for "i18n.run_template_filter" in "_load_engines" function works fine and returns correct value, so i18n in templates works fine.

PS. Note that after that change - all console messages are coming twice - not sure why.

comment:2 Changed 12 years ago by uf766086

My workaround is to change default value to True when loading i18n config (at _load_engines()). Like this:

from

"kid.i18n.run_template_filter" : config.get("i18n.run_template_filter",
                                                  False),

to

"kid.i18n.run_template_filter" : config.get("i18n.run_template_filter",
                                                  True),

comment:3 follow-up: ↓ 4 Changed 12 years ago by jorge.vargas

  • Component changed from tg-admin (non-toolbox) to Docs
  • Severity changed from normal to minor
  • Milestone set to 1.0.2

ok both things are actually doing the same.

but I believe all you have to do is add i18n.run_template_filter = True in your app.cfg and everything should work.

if this is the case this is a docs issue.

About point #1 that's a feature request please open another bug for it.

comment:4 in reply to: ↑ 3 Changed 12 years ago by uf766086

i18n.run_template_filter is set to True in my app.cfg... but it seems that engine is loaded before cfg is parsed.

Replying to jorge.vargas:

ok both things are actually doing the same.

but I believe all you have to do is add i18n.run_template_filter = True in your app.cfg and everything should work.

if this is the case this is a docs issue.

About point #1 that's a feature request please open another bug for it.

comment:5 follow-up: ↓ 6 Changed 12 years ago by fredlin

So the TODOs are:

  1. Need add "i18n.run_template_filter = True" description in app.cfg
  1. check what's happened if engine is loaded before cfg is parsed.
  1. update  http://docs.turbogears.org/1.0/Internationalization

comment:6 in reply to: ↑ 5 Changed 12 years ago by uf766086

Replying to fredlin:

So the TODOs are:

  1. Need add "i18n.run_template_filter = True" description in app.cfg

Already there

  1. check what's happened if engine is loaded before cfg is parsed.

What happens is that engine is not aware that should filter templates to add i18n

  1. update  http://docs.turbogears.org/1.0/Internationalization

Update to show this bug?

I think the TODO is fix the bug. If my work allows it I will take a look...

comment:7 Changed 11 years ago by alberto

  • Milestone changed from 1.0.2 to 1.0.3

comment:8 Changed 11 years ago by andrex

  • Version changed from 1.0b2 to 1.0

I get it working adding this to my Root controller:

class Root(controllers.RootController):
    def __init__(self):
        i18n.get_locale()

hope this help!

comment:9 Changed 11 years ago by andrex

sorry, wasn't that, it only needs:

session_filter.on = True
i18n.run_template_filter = True

on app.cfg to work. my mistake

so the second bug I believe is fixed on 1.0 ...

comment:10 Changed 11 years ago by faide

  • Milestone changed from 1.0.3 to 1.1

comment:11 Changed 11 years ago by Chris Arndt

  • Owner changed from anonymous to faide
  • Component changed from Docs to tg-admin (non-toolbox)
  • Milestone changed from 1.1 to 1.0.3

Can somebody (i.e. the original reporter) confirm that this is fixed? It's defintely not a doc issue anymore so I set the component to tg-admin again.

comment:12 Changed 11 years ago by faide

  • Status changed from new to closed
  • Resolution set to fixed

I have created a new ticket to keep the first bug. This way I just close this ticket since bug 2 is not an issue anymore since it works.

For tracking bug 1, just look at ticket #1436.

Note: See TracTickets for help on using tickets.