Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10749 closed defect (fixed)

`babel.Translations.load({...}).install()` from a plugin breaks the loaded translations catalog

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0
Component: i18n Version: 0.12
Severity: normal Keywords:
Cc: ryano@… Branch:
Release Notes:

Correctly handle multiple i18n domains in JavaScript translations.

API Changes:
Internal Changes:

Description (last modified by Jun Omae)

generate_messages_js command of setuptools works for Trac and Trac plugins. The command generates "messages file for javascript" as the following;

// Generated messages javascript file from compiled MO file
babel.Translations.load({"domain":"{plugin-name}-js",...}).install();

The babel.Translations.install() installs _, genetext and ngettext functions binded the loaded translations instance to window instance.

When a plugin loads the messages catalog for javascript, Therefore, it overwrites the last installed functions (maybe from trac/htdocs/messages/*.js) and messages for Trac will not be translated.

Related branches

Attachments (1)

Comment1.png (14.3 KB ) - added by Ryan J Ollos <ryano@…> 8 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Jun Omae, 8 years ago

Description: modified (diff)

comment:2 by Christian Boos, 8 years ago

Looks sound. Unfortunately, I don't have a quick way to try this by myself, so feel free to apply.

in reply to:  2 comment:3 by Jun Omae, 8 years ago

Resolution: fixed
Status: newclosed

Replying to cboos:

Looks sound. Unfortunately, I don't have a quick way to try this by myself, so feel free to apply.

Applied in [11101]. Thanks.

comment:4 by Jun Omae, 8 years ago

Owner: set to Jun Omae

by Ryan J Ollos <ryano@…>, 8 years ago

Attachment: Comment1.png added

comment:5 by Ryan J Ollos <ryano@…>, 8 years ago

Strange that the heading for comment:1 is shown even though Comments only is selected. Even more strange is that I can't reproduce this behavior in a dev instance of r11100, or on the demo site, which is at r11050.

comment:6 by Peter Suter, 8 years ago

I think comment:1 contains a newline, so it isn't considered empty. (Reproduce it on the demo-0.13 site by pressing the Enter key in the comment field before submitting.)

comment:7 by Remy Blank, 8 years ago

We could strip the comment when checking if it's empty.

in reply to:  7 ; comment:8 by Ryan J Ollos <ryano@…>, 8 years ago

Replying to rblank:

We could strip the comment when checking if it's empty.

The behavior seems closely related to the patch in #10748, so I'll add to my todo list to handle this case as part of that patch as well.

Last edited 8 years ago by Christian Boos (previous) (diff)

comment:9 by Ryan J Ollos <ryano@…>, 8 years ago

Cc: ryano@… added

in reply to:  8 comment:10 by Ryan J Ollos <ryano@…>, 8 years ago

Replying to Ryan J Ollos <ryano@…>:

The behavior seems closely related to the patch in #10478, so I'll add to my todo list to handle this case as part of that patch as well.

Issue has been addressed in the following patch ticket:10748:t10748-r11103-1.patch

Version 0, edited 8 years ago by Ryan J Ollos <ryano@…> (next)

comment:11 by Christian Boos, 8 years ago

Release Notes: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.