Edgewall Software

Opened 12 years ago

Closed 12 years ago

#10038 closed enhancement (fixed)

Descriptions of wiki macros should be translated

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0
Component: i18n Version:
Severity: normal Keywords: i18n macro
Cc: Branch:
Release Notes:

The macro documents are translated in the language settings.

API Changes:

trac.wiki.api: get_macro_description return a tuple of gettext domain and macro description. The gettext domain is used to translate the description.

Internal Changes:

Description (last modified by Jun Omae)

extract_messages extracts all descriptions of wiki macros and [[MacroList]] macro shows the translated messages.

Attachments (0)

Change History (6)

comment:1 by Jun Omae, 12 years ago

Description: modified (diff)

comment:2 by Jun Omae, 12 years ago

Owner: set to Jun Omae
Status: newassigned

I worked the issue, https://github.com/jun66j5/trac/compare/t10038-i18n-macro-doc.

New keyword to extract localized strings. This function don't translate like N_, however it returns cleandoc'ed text and the extractor extracts cleandoc'ed text.
It can return a tuple of gettext domain and a description of the macro. The values are used to translate in [[MacroList]].
Adds doc_domain variable to translate with the domain. If speicfied, get_macro_description returns a tuple of self.doc_domain and docstring of the subclass. If not specified, it returns simply docstring of the subclass.

Increase +14 messages.

comment:3 by Christian Boos, 12 years ago

Nice! Works great. I even think we should push this further: the macro documentation should be placed only in the get_macro_description(), and no longer as the class docstring. That way, we could use the docstrings as developer specific documentation if needed. The user facing documentation would not be that useful in the ApiDoc, and anyway gets badly formatted because of the wiki syntax.

It seems cleandoc_ can be useful in other places if we'd like to get long messages translated, but maybe we should replace existing ones carefully in order to play well with the update.

comment:4 by Jun Omae, 12 years ago

Ok, updated the branch.

  1. WikiMacroBase.get_macro_description() returns (self._domain, self._description), _domain and _description are specified in the subclasses. When _domain and _descriptino are None, it returns the class docstring for pre-0.12 compatibility.
  2. The subclasses of WikiMacroBase no longer use the class docstring.

BTW, should we move WikiMacroBase from trac.wiki.macro to trac.wiki.api in 0.13?

comment:5 by Jun Omae, 12 years ago

Milestone: 0.140.13

comment:6 by Jun Omae, 12 years ago

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Commited in [10617]. We can translate the macro documents.

Modify Ticket

Change Properties
Set your email in Preferences
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.