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 #1405 (closed enhancement: fixed)

Opened 12 years ago

Last modified 11 years ago

[PATCH] i18n enhancements

Reported by: droggisch Owned by: faide
Priority: normal Milestone: 1.0.4
Component: TurboGears Version: trunk
Severity: normal Keywords:
Cc:

Description

This ticket introduces some new concepts for i18n of JS-code plus a variety of enhancements and bugfixes for existing functionality.

What does it do? The scope is basically threefold:

  1. making DateTimeConverter? and CalendarDatePicker? take a callable as format. That was missing.
  2. fixing (IMHO) the behavior of the tg-admin i18n collect command to gather texts from KID-templates in a way that then will work together with the already existing KID filter. It will treat text-children the same way the filter does. Additionally, the support for tags containing lang="xx"-attributes is enhanced, it has been buggy.
  3. allow for JS-I18N. To do so, I created a new widget, JSI18NWidget. It can be automatically included by adding "turbogears.jsi18nwidget" to tg.include_widgets.
    The least thing that happens is that i18n_base.js is added to the scripts for each page. It simply defines a _()-function to be used within JS. Then the tg-admin i18n collect command has been enhanced to collect strings from js-files found in the project.
    And there is a new tg-admin i18n subcommand now, create_js_messages.
    With this command, files of the name
         <catalog>-<locale>.js
    
    are created. The widget will automatically include the appropriate one, thus enabling translation.

I attached a patch + the js-file that goes into the same place as the other TG-JSses.

Attachments

i18n_base.js Download (151 bytes) - added by droggisch 12 years ago.
TestJS.tar.bz2 Download (84.9 KB) - added by alberto 12 years ago.
sample app to test this
i18n.patch Download (18.3 KB) - added by droggisch 12 years ago.

Change History

Changed 12 years ago by droggisch

Changed 12 years ago by alberto

sample app to test this

comment:1 Changed 12 years ago by alberto

Discussion at this  thread

Thanks! :)

Changed 12 years ago by droggisch

comment:2 Changed 12 years ago by faide

  • Summary changed from i18n enhancements to [PATCH] i18n enhancements

comment:3 Changed 12 years ago by faide

  • Owner changed from anonymous to faide
  • Status changed from new to assigned

comment:4 Changed 12 years ago by faide

  • Status changed from assigned to new
  • Owner changed from faide to droggisch

Since you committed everything (and also proposed the patch) I give you the "ownership" of the ticket.

We keep this open so we remember to add documentation for it.

comment:5 Changed 12 years ago by Chris Arndt

  • Milestone changed from 1.0.3 to 1.0.4

Batch promoting 1.0.3 tickets to Milestone 1.0.4

comment:6 Changed 12 years ago by droggisch

  • Owner changed from droggisch to faide

Please review documentation changes in

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

comment:7 Changed 11 years ago by faide

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

Reviewed docs... seems correct to me. Thanks a bunch Diez!

Note: See TracTickets for help on using tickets.