Modify

Opened 8 years ago

Closed 8 years ago

#6227 closed defect (fixed)

Check translation strings before creating language files

Reported by: felixfqiu@… Owned by: stoecker
Priority: normal Milestone:
Component: Core Version: tested
Keywords: locale escaping translation Cc:

Description

Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2011-04-14 01:31:50
Last Changed Author: bastiK
Revision: 4021
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2011-04-13 22:43:46 +0200 (Wed, 13 Apr 2011)
Last Changed Rev: 4021

Identification: JOSM/1.5 (4021 zh_CN)
Memory Usage: 139 MB / 494 MB (12 MB allocated, but free)
Java version: 1.6.0_24, Sun Microsystems Inc., Java HotSpot(TM) Client VM
Operating system: Windows XP

Dataset consistency test:
[WARN - NO NODES] Way {Way id=-372198 version=0 V nodes=[{Node id=-238640 version=0 V lat=39.9244585,lon=116.3875896}]} has only one node

Plugin: openstreetbugs (25664)
Plugin: turnrestrictions (25465)

java.lang.IllegalArgumentException: can't parse argument number URL

at java.text.MessageFormat.makeFormat(Unknown Source)
at java.text.MessageFormat.applyPattern(Unknown Source)
at java.text.MessageFormat.<init>(Unknown Source)
at java.text.MessageFormat.format(Unknown Source)
at org.openstreetmap.josm.tools.I18n.tr(I18n.java:141)
at org.openstreetmap.josm.io.GpxExporter.exportData(GpxExporter.java:88)
at org.openstreetmap.josm.actions.SaveActionBase.doSave(SaveActionBase.java:63)
at org.openstreetmap.josm.actions.SaveActionBase.doSave(SaveActionBase.java:44)
at org.openstreetmap.josm.actions.SaveActionBase.actionPerformed(SaveActionBase.java:33)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Attachments (0)

Change History (11)

comment:1 Changed 8 years ago by xeen

This issue is language dependent and occurs only for zh_CN (or probably more languages, haven't checked).

The error appears because "Copyright (URL)" was translated as "授权 {URL}" and it appears the curly braces are 'active' characters that need to be escaped. From what I can tell they should be enclosed in single quotes as described here:
http://struts.apache.org/2.x/docs/how-to-escape-special-chars-in-resource-bundles.html

However, if I read launchpad correctly someone already switched to round braces, so the error should be gone with the next locale update.
https://translations.launchpad.net/josm/trunk/+pots/josm/zh_CN/2836/+translate

I'm not convinced adding try-catch to every MessageFormat.format is the way to go, especially since you can't translate the dialog. Maybe a script could be run before building testing checking for these kind of errors? Launchpad won't let me download a translation for some reason, so if someone can provide a non-binary language file I'd give it a try.

comment:2 Changed 8 years ago by anonymous

Keywords: locale escaping translation added
Owner: changed from team to stoecker

comment:3 Changed 8 years ago by stoecker

The po-files are checked-in in i18n directory. The i18n.pl script already parses every string, so probably we could add relevant checks there:

  • no ', but '' (check even in english original strings!)
  • no additional {..} or {..} which don't match english string

In launchpad you can only order to send you a download-string by mail.

Last edited 8 years ago by stoecker (previous) (diff)

comment:4 Changed 8 years ago by stoecker

@xeen:
Do you know how to change (undocumented) Perl code or need I have a look? I currently feel more like improving the GPX displaying and adding the new Imagery server support :-)

I would say i18n.pl should warn about (creating a log file when possible, as there come lots of outputs during build) and simply drop wrong strings, so they do no harm and can be fixed when reading logfile.

Best would be a new function for the validity checks, as then we can add more checks in future when necessary.

comment:5 Changed 8 years ago by stoecker

Summary: error when Ctrl+Shift+S (*.gpx *.gpx.gz)Check translation strings before creating language files

comment:6 Changed 8 years ago by xeen

Yeah, sorry, but I don't do Perl… and looking at i18n.pl I won't start now, either.

comment:7 Changed 8 years ago by stoecker

Whoops, there are a lot of errors in the strings. Should have add such checks much earlier.

I fixed some strings, but a lot more must be done, especially regarding the ' to '' issue. But we can't simply change the strings, as this would break all valid translations. We need to upgrade string and translations in one step to keep them.

comment:8 Changed 8 years ago by xeen

I guess a mail to all active translators and or mailing list would be in order… however, is ' ' really that bad issue?

Some "message" text

would become

irgendwelcher 'nachrichten' text

in the GUI. Since neither are proper quotation marks (i.e. “ ” for English text) I fail to see why this is so bad.

Last edited 8 years ago by xeen (previous) (diff)

comment:9 Changed 8 years ago by stoecker

No. A single quote is not displayed at all in Java. So 'test' becomes simply test and don't becomes dont. Usually that is not wanted. In translations the double '' in words can be prevented by using the ’ sign, so text looks better.

That's why we need to fix the many wrong English strings. Well, I see what I can do tomorrow. In the past I already wrote a script for such mass edits, which keep translation in sync.

comment:10 Changed 8 years ago by stoecker

In [4253/josm]:

see #6227 - fix wrong quote escaping in strings

comment:11 Changed 8 years ago by stoecker

Resolution: fixed
Status: newclosed

Fixed the source errors and uploaded fixed translations. The Translations must be fixed step by step now until all errors vanish.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain stoecker.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.