Edgewall Software

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#12869 closed defect (fixed)

"View log starting at <input /> and back to <input />" is separated in extracted messages — at Version 8

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.3.2
Component: i18n Version: 1.3dev
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Improve check_catalog command to check whether same markups are used between msgid and msgstr in translations.

API Changes:
Internal Changes:

Description

In trac/versioncontrol/templates/revisionlog.html, the following is extracted to three messages.

          <label>
            View log starting at <input type="text" id="rev" name="rev" value="..." size="5" />
          </label>
          and
          <label>
            back to <input type="text" id="stop_rev" name="stop_rev" value="" size="5" />
          </label>
#: trac/versioncontrol/templates/revisionlog.html:93
#, python-format
msgid "View log starting at %(start)s"
msgstr ""

#: trac/versioncontrol/templates/revisionlog.html:98
#, python-format
msgid "back to %(end)s"
msgstr ""

#: trac/versioncontrol/templates/revisionlog.html:101
#, python-format
msgid "%(start_label)s and %(end_label)s"
msgstr ""

I think we should avoid to separate messages.

  • trac/versioncontrol/templates/revisionlog.html

     
    8888          <input type="text" id="stop_rev" name="stop_rev"
    8989                 value="${stop_rev}" size="5" />
    9090          # endset
    91           # set start_label
    92           <label>
    93             ${tag_("View log starting at %(start)s", start=input_start)}
    94           </label>
    95           # endset
    96           # set end_label
    97           <label>
    98             ${tag_("back to %(end)s", end=input_end)}
    99           </label>
    100           # endset
    101           # trans start_label, end_label
     91          # trans start=input_start, end=input_end
    10292
    103           ${start_label} and ${end_label}
     93          <label>View log starting at ${start}</label> and <label>back to ${end}</label>
    10494
    10595          # endtrans
    10696          <br />

Change History (8)

comment:1 by Jun Omae, 7 years ago

Milestone: 1.3.21.3.3

comment:2 by Ryan J Ollos, 7 years ago

Feel free to target to milestone:1.3.2 if you like. I won't get to the release until next weekend.

comment:3 by Jun Omae, 7 years ago

Milestone: 1.3.31.3.2
Owner: set to Jun Omae
Status: newassigned

Okay. Retargeted to 1.3.2. I'll push the changes tonight.

Also, the same issue exists in timeline.html, 4 messages are extracted from the following.

<label>
  View changes from <input type="text" id="fromdate" class="trac-datepicker" size="10" name="from" value="" />
</label>
<label>
  going back <input type="text" size="3" name="daysback" value="3" />
</label>
<label>
  by author <input type="text" size="16" name="authors" value="" />
</label>
#: trac/timeline/templates/timeline.html:48
#, python-format
msgid "View changes from %(fromdate)s"
msgstr ""

#: trac/timeline/templates/timeline.html:54
#, python-format
msgid "going back %(daysback)s days"
msgstr ""

#: trac/timeline/templates/timeline.html:59
#, python-format
msgid "by author %(authors)s"
msgstr ""

#: trac/timeline/templates/timeline.html:62
#, python-format
msgid "%(view_from_label)s <br /> %(back_to_label)s <br /> %(by_author_label)s"
msgstr ""

Proposed changes:

  • trac/timeline/templates/timeline.html

    diff --git a/trac/timeline/templates/timeline.html b/trac/timeline/templates/timeline.html
    index 1b29f1fb8..4f8ebda7d 100644
    a b  
    4343          # set authors_input
    4444          <input type="text" size="16" name="authors" value="${authors}" />
    4545          # endset
    46           # set view_from_label
    47           <label>
    48             ${tag_("View changes from %(fromdate)s",
    49             fromdate=fromdate_input)}
    50           </label>
    51           # endset
    52           # set back_to_label
    53           <label>
    54             ${tag_("going back %(daysback)s days", daysback=daysback_input)}
    55           </label>
    56           # endset
    57           # set by_author_label
    58           <label>
    59             ${tag_("by author %(authors)s", authors=authors_input)}
    60           </label>
    61           # endset
    62           # trans view_from_label, back_to_label, by_author_label
     46          # trans fromdate=fromdate_input, daysback=daysback_input, authors=authors_input
    6347
    64           ${view_from_label} <br /> ${back_to_label} <br /> ${by_author_label}
     48          <label>View changes from ${fromdate}</label>
     49          <br />
     50          <label>going back ${daysback} days</label>
     51          <br />
     52          <label>by author ${authors}</label>
    6553
    6654          # endtrans
    6755        </div>

comment:4 by Christian Boos, 7 years ago

Well, I did it that way in order to avoid introducing markup in the catalogs. Obviously, if we start to allow or encourage that, the templates can be simplified, but then we should probably also add some markup validation for messages in the translations, a bit like we did for Genshi nesting of groups (cf. r11230).

comment:5 by Jun Omae, 7 years ago

Committed in [16138].

Validating messages with markups in translations sounds good. I try to improve check_catalog command.

comment:6 by Jun Omae, 7 years ago

Proposed changes in [f3e7bbc70/jomae.git] (jomae.git@t12869).

Example:

$ make check-ja
check-ja: python  setup.py  check_catalog -l ja  check_catalog_js -l ja  check_catalog_tracini -l ja
running check_catalog
checking catalog trac/locale/ja/LC_MESSAGES/messages.po
trac/locale/ja/LC_MESSAGES/messages.po:186: mismatched "strong" tag between msgid and msgstr (1 != 0)
trac/locale/ja/LC_MESSAGES/messages.po:186: mismatched "b" tag between msgid and msgstr (0 != 1)
trac/locale/ja/LC_MESSAGES/messages.po:192: mismatched tag: line 2, column 16
running check_catalog_js
checking catalog trac/locale/ja/LC_MESSAGES/messages-js.po
running check_catalog_tracini
checking catalog trac/locale/ja/LC_MESSAGES/tracini.po
msgfmt OK
$ 
$ make check-zh_CN
check-zh_CN: python  setup.py  check_catalog -l zh_CN  check_catalog_js -l zh_CN  check_catalog_tracini -l zh_CN
running check_catalog
checking catalog trac/locale/zh_CN/LC_MESSAGES/messages.po
trac/locale/zh_CN/LC_MESSAGES/messages.po:5763: not well-formed (invalid token): line 2, column 23
trac/locale/zh_CN/LC_MESSAGES/messages.po:6062: mismatched "br" tag between msgid and msgstr (0 != 1)
running check_catalog_js
checking catalog trac/locale/zh_CN/LC_MESSAGES/messages-js.po
running check_catalog_tracini
checking catalog trac/locale/zh_CN/LC_MESSAGES/tracini.po
trac/locale/zh_CN/LC_MESSAGES/messages.po:9: warning: header field 'Language' missing in header
trac/locale/zh_CN/LC_MESSAGES/messages-js.po:7: warning: header field 'Language' missing in header
trac/locale/zh_CN/LC_MESSAGES/tracini.po:7: warning: header field 'Language' missing in header
msgfmt OK

comment:7 by Ryan J Ollos, 7 years ago

Looks good to me.

comment:8 by Jun Omae, 7 years ago

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

Thanks. Committed in [16154].

Note: See TracTickets for help on using tickets.