diff --git a/build.xml b/build.xml index 96c629e..bc6bd91 100644 --- a/build.xml +++ b/build.xml @@ -5,7 +5,7 @@ <property name="commit.message" value="Commit message"/> <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> <property name="plugin.main.version" value="14153"/> - <property name="version.entry.commit.revision" value="18"/> + <property name="version.entry.commit.revision" value="23"/> <!-- Configure these properties (replace "..." accordingly). See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins @@ -22,7 +22,7 @@ <target name="additional-manifest"> <manifest file="MANIFEST" mode="update"> - <attribute name="14153_Plugin-Url" value="22;https://github.com/maripo/JOSM_quicklabel/releases/download/22/QuickLabel.jar" /> + <attribute name="14153_Plugin-Url" value="23;https://github.com/maripo/JOSM_quicklabel/releases/download/23/QuickLabel.jar" /> <attribute name="13661_Plugin-Url" value="21;https://github.com/maripo/JOSM_quicklabel/releases/download/21/QuickLabel.jar" /> <attribute name="12545_Plugin-Url" value="v1.0.1;https://github.com/maripo/JOSM_quicklabel/releases/download/v1.0.1/QuickLabel.jar" /> </manifest> diff --git a/i18n/en.po b/i18n/en.po new file mode 100644 index 0000000..6fcd77a --- /dev/null +++ b/i18n/en.po @@ -0,0 +1,78 @@ +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:48 +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:50 +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:55 +msgid "Show specified tag values next to objects" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:92 +msgid "Your QuickLabel config is applied." +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:126 +msgid "Restore default" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:190 +msgid "Move up" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:191 +msgid "Move down" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:244 +msgid "Main" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:245 +msgid "Sub" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:257 +msgid "" +"<html>Tags to show next to objects.<br>You can specify multiple tags by " +"writing into multiple lines<br>in the order of descending priorities.</html>" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:259 +msgid "" +"<html>Label format will be \"<b><i>Main</i>(<i>Sub</i>)</b>\" or " +"\"<b><i>Sub</i></b>\" if main tag is empty.</html>" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:280 +msgid "Show key-value pairs" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:281 +msgid "Always show sub tag with parentheses" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:282 +msgid "Apply on startup" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:284 +msgid "Apply" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:285 +msgid "Apply change and show customized labels" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:293 +msgctxt "quicklabel" +msgid "Reset" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:294 +msgid "Reset QuickLabel config and show default labels" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:302 +msgid "Cancel" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:303 +msgid "Close this window without saving" +msgstr "" diff --git a/i18n/ja.po b/i18n/ja.po new file mode 100644 index 0000000..64b01dd --- /dev/null +++ b/i18n/ja.po @@ -0,0 +1,104 @@ +# Japanese translations for PACKAGE package. +# Copyright (C) 2017 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Mariko GODA <EMAIL@ADDRESS>, 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-07-15 21:41+0900\n" +"PO-Revision-Date: 2017-09-18 21:19+0900\n" +"Last-Translator: Mariko GODA <EMAIL@ADDRESS>\n" +"Language-Team: Japanese\n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:48 +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:50 +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:55 +msgid "Show specified tag values next to objects" +msgstr "指定したタグの値をオブジェクトの隣に表示します" + +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:92 +msgid "Your QuickLabel config is applied." +msgstr "QuickLabelの設定が適用されました" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:126 +msgid "Restore default" +msgstr "デフォルトに戻す" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:190 +msgid "Move up" +msgstr "1つ上に" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:191 +msgid "Move down" +msgstr "1つ下に" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:244 +msgid "Main" +msgstr "メイン" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:245 +msgid "Sub" +msgstr "サブ" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:257 +msgid "" +"<html>Tags to show next to objects.<br>You can specify multiple tags by " +"writing into multiple lines<br>in the order of descending priorities.</html>" +msgstr "" +"<html>オブジェクトの隣に表示するタグを指定します。<br>複数のタグを指定するこ" +"ともできます。優先順位順に1行ずつ記入してください。</html>" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:259 +msgid "" +"<html>Label format will be \"<b><i>Main</i>(<i>Sub</i>)</b>\" or " +"\"<b><i>Sub</i></b>\" if main tag is empty.</html>" +msgstr "" +"<html>ラベルのフォーマットは \"<b><i>メイン</i>(<i>サブ</i>)</b>\" になりま" +"す。<br>メインのタグがない場合は \"<b><i>サブ</i></b>\" になります。</html>" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:280 +msgid "Show key-value pairs" +msgstr "キーと値を両方表示する" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:281 +msgid "Always show sub tag with parentheses" +msgstr "サブのタグを必ず括弧に入れて表示する" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:282 +msgid "Apply on startup" +msgstr "起動時に適用する" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:284 +msgid "Apply" +msgstr "適用" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:285 +msgid "Apply change and show customized labels" +msgstr "内容を適用し、カスタマイズしたラベルを表示する" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:293 +msgctxt "quicklabel" +msgid "Reset" +msgstr "通常表示に戻す" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:294 +msgid "Reset QuickLabel config and show default labels" +msgstr "QuickLabelで設定した内容をリセットし、通常の表示に戻す" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:302 +msgid "Cancel" +msgstr "キャンセル" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:303 +msgid "Close this window without saving" +msgstr "セーブせずにこのウィンドウを閉じる" + +#~ msgid "Sub labels" +#~ msgstr "サブ" diff --git a/i18n/messages.po b/i18n/messages.po new file mode 100644 index 0000000..4d562d5 --- /dev/null +++ b/i18n/messages.po @@ -0,0 +1,97 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-07-15 21:41+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:48 +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:50 +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:55 +msgid "Show specified tag values next to objects" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelPlugin.java:92 +msgid "Your QuickLabel config is applied." +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:126 +msgid "Restore default" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:190 +msgid "Move up" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:191 +msgid "Move down" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:244 +msgid "Main" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:245 +msgid "Sub" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:257 +msgid "" +"<html>Tags to show next to objects.<br>You can specify multiple tags by " +"writing into multiple lines<br>in the order of descending priorities.</html>" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:259 +msgid "" +"<html>Label format will be \"<b><i>Main</i>(<i>Sub</i>)</b>\" or " +"\"<b><i>Sub</i></b>\" if main tag is empty.</html>" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:280 +msgid "Show key-value pairs" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:281 +msgid "Always show sub tag with parentheses" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:282 +msgid "Apply on startup" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:284 +msgid "Apply" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:285 +msgid "Apply change and show customized labels" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:293 +msgctxt "quicklabel" +msgid "Reset" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:294 +msgid "Reset QuickLabel config and show default labels" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:302 +msgid "Cancel" +msgstr "" + +#: src/org/maripo/josm/quicklabel/QuickLabelDialog.java:303 +msgid "Close this window without saving" +msgstr "" diff --git a/i18n_deploy.sh b/i18n_deploy.sh new file mode 100755 index 0000000..40a79ef --- /dev/null +++ b/i18n_deploy.sh @@ -0,0 +1,2 @@ +#!/bin/sh +perl ../../i18n/i18n.pl --basedir=data --potfile=i18n/messages.po i18n/en.po i18n/ja.po diff --git a/i18n_start.sh b/i18n_start.sh new file mode 100755 index 0000000..0819924 --- /dev/null +++ b/i18n_start.sh @@ -0,0 +1,11 @@ +#!/bin/sh +find . -name '*.java' | xargs xgettext -k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3 +mv -f messages.po i18n +# Backup +cd i18n +mv -f ja.po ja.po.prev +mv -f en.po en.po.prev +msgmerge ja.po.prev messages.po -o ja.po +msgmerge en.po.prev messages.po -o en.po +cd - +echo 'Edit i18n/*.po and exec i18n_deploy.sh' diff --git a/src/org/maripo/josm/quicklabel/config/QuickLabelConfig.java b/src/org/maripo/josm/quicklabel/config/QuickLabelConfig.java index 186d261..5b6cc27 100644 --- a/src/org/maripo/josm/quicklabel/config/QuickLabelConfig.java +++ b/src/org/maripo/josm/quicklabel/config/QuickLabelConfig.java @@ -2,6 +2,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import sun.misc.Unsafe; import org.maripo.josm.quicklabel.strategy.QuickLabelCompositionStrategy; import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy; @@ -89,16 +90,14 @@ private void setStrategy(LabelCompositionStrategy strategy) { System.out.println("QuickLabelConfig.setStrategy " + strategy); TextLabel.AUTO_LABEL_COMPOSITION_STRATEGY.toString(); try { - + Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe"); + unsafeField.setAccessible(true); + Unsafe unsafe = (Unsafe) unsafeField.get(null); + Field field = TextLabel.class.getDeclaredField("AUTO_LABEL_COMPOSITION_STRATEGY"); field.setAccessible(true); - // Remove "final" modifier from AUTO_LABEL_COMPOSITION_STRATEGY - // TODO: java.lang.NoSuchFieldException: modifiers - Field modifierField = Field.class.getDeclaredField("modifiers"); - modifierField.setAccessible(true); - modifierField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - // Replace! - field.set(null, strategy); + unsafe.putObject(unsafe.staticFieldBase(field), unsafe.staticFieldOffset(field), strategy); + } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) {