Skip to content

Commit

Permalink
Merge pull request #10 from MIERUNE/translation-en
Browse files Browse the repository at this point in the history
set default lang as English, and add translation for Japanese
  • Loading branch information
Kanahiro authored Dec 12, 2020
2 parents 3995578 + e456280 commit 3188937
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 14 deletions.
7 changes: 7 additions & 0 deletions gtfs_go.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SOURCES += gtfs_go.py \
gtfs_go_dialog.py

FORMS += gtfs_go_dialog_base.ui \
gtfs_go_loader_base.ui

TRANSLATIONS = ./i18n/GTFSGO_ja.ts
1 change: 0 additions & 1 deletion gtfs_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,5 @@ def unload(self):

def run(self):
"""Run method that loads and starts the plugin"""

self.dialog = GTFSGoDialog(self.iface)
self.dialog.show()
9 changes: 3 additions & 6 deletions gtfs_go_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,18 @@

class GTFSGoDialog(QtWidgets.QDialog):

combobox_placeholder_text = '---読み込むデータを選択---'
combobox_zip_text = '---zipファイルから読み込み---'

def __init__(self, iface):
"""Constructor."""
super().__init__()
self.ui = uic.loadUi(os.path.join(os.path.dirname(
__file__), 'gtfs_go_dialog_base.ui'), self)
with open(DATALIST_JSON_PATH) as f:
print(f)
self.datalist = json.load(f)
self.iface = iface
self.combobox_zip_text = self.tr('---Load local ZipFile---')
self.init_gui()

def init_gui(self):
self.ui.comboBox.addItem(self.combobox_placeholder_text, None)
self.ui.comboBox.addItem(self.combobox_zip_text, None)
for data in self.datalist:
self.ui.comboBox.addItem(self.make_combobox_text(data), data)
Expand Down Expand Up @@ -131,7 +127,8 @@ def show_geojson(self, geojson_dir: str):
self.add_layers_as_group(group_name, [routes_vlayer, stops_vlayer])

self.iface.messageBar().pushInfo(
'完了', f'{geojson_dir}に.geojsonファイルが出力されました')
self.tr('finish'),
self.tr('generated geojson files: ') + geojson_dir)
self.ui.close()

def get_source(self):
Expand Down
24 changes: 18 additions & 6 deletions gtfs_go_dialog_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>データ取得先を選択:</string>
<string>GTFS-Datasource</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>出力先フォルダを指定:</string>
<string>Output directory</string>
</property>
</widget>
</item>
Expand All @@ -65,21 +65,33 @@
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>オプション:</string>
<string>Options</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="ignoreShapesCheckbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>shapesを無視</string>
<string>ignore shapes.txt</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QCheckBox" name="ignoreNoRouteStopsCheckbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>経路を持たないstopsを無視</string>
<string>ignore isolated stops</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -133,7 +145,7 @@
</sizepolicy>
</property>
<property name="text">
<string>QGISに読み込み</string>
<string>Extract on QGIS</string>
</property>
</widget>
</item>
Expand Down
2 changes: 1 addition & 1 deletion gtfs_go_loader_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</sizepolicy>
</property>
<property name="text">
<string>キャンセル</string>
<string>Abort</string>
</property>
</widget>
</item>
Expand Down
Binary file added i18n/GTFSGO_ja.qm
Binary file not shown.
78 changes: 78 additions & 0 deletions i18n/GTFSGO_ja.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ja" sourcelanguage="en">
<context>
<name>GTFSGo</name>
<message>
<location filename="../gtfs_go.py" line="200"/>
<source>&amp;GTFS GO</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gtfs_go.py" line="169"/>
<source>GTFS GO</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GTFSGoDialog</name>
<message>
<location filename="../gtfs_go_dialog.py" line="56"/>
<source>---Load local ZipFile---</source>
<translation>---ZIPファイルから読み込み---</translation>
</message>
<message>
<location filename="../gtfs_go_dialog.py" line="129"/>
<source>finish</source>
<translation>完了</translation>
</message>
<message>
<location filename="../gtfs_go_dialog.py" line="129"/>
<source>generated geojson files: </source>
<translation>GeoJSONファイルが出力されました: </translation>
</message>
</context>
<context>
<name>GTFSGoDockWidgetBase</name>
<message>
<location filename="../gtfs_go_loader_base.ui" line="20"/>
<source>GTFS GO</source>
<translation></translation>
</message>
<message>
<location filename="../gtfs_go_dialog_base.ui" line="41"/>
<source>GTFS-Datasource</source>
<translation>GTFSデータを選択</translation>
</message>
<message>
<location filename="../gtfs_go_dialog_base.ui" line="48"/>
<source>Output directory</source>
<translation>出力先フォルダ</translation>
</message>
<message>
<location filename="../gtfs_go_dialog_base.ui" line="68"/>
<source>Options</source>
<translation>オプション</translation>
</message>
<message>
<location filename="../gtfs_go_dialog_base.ui" line="81"/>
<source>ignore shapes.txt</source>
<translation>shapes.txtを無視する</translation>
</message>
<message>
<location filename="../gtfs_go_dialog_base.ui" line="94"/>
<source>ignore isolated stops</source>
<translation>経路を持たないstopsを無視する</translation>
</message>
<message>
<location filename="../gtfs_go_dialog_base.ui" line="148"/>
<source>Extract on QGIS</source>
<translation>QGISに読み込む</translation>
</message>
<message>
<location filename="../gtfs_go_loader_base.ui" line="52"/>
<source>Abort</source>
<translation>中断</translation>
</message>
</context>
</TS>

0 comments on commit 3188937

Please sign in to comment.