Ticket #1228 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

i18n and kid: not functional

Reported by: jtate Assigned to: 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

(in reply to: ↑ description ) 01/12/07 10:11:14 changed 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.

01/26/07 14:39:23 changed 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),

(follow-up: ↓ 4 ) 01/30/07 15:22:55 changed 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.

(in reply to: ↑ 3 ) 02/03/07 05:48:02 changed 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.

(follow-up: ↓ 6 ) 02/03/07 10:13:19 changed by fredlin

So the TODOs are:

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

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

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

(in reply to: ↑ 5 ) 02/05/07 05:41:45 changed by uf766086

Replying to fredlin:

So the TODOs are: 1. Need add "i18n.run_template_filter = True" description in app.cfg

Already there

2. 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

3. 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...

05/01/07 12:56:57 changed by alberto

  • milestone changed from 1.0.2 to 1.0.3.

05/09/07 18:23:56 changed 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!

05/10/07 08:48:10 changed 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 ...

07/01/07 17:57:40 changed by faide

  • milestone changed from 1.0.3 to 1.1.

07/11/07 03:15:40 changed 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.

07/11/07 04:09:15 changed 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.