diff --git a/i18n/jaxaEarthApi_en.qm b/i18n/jaxaEarthApi_en.qm
new file mode 100644
index 0000000..6dc9981
Binary files /dev/null and b/i18n/jaxaEarthApi_en.qm differ
diff --git a/i18n/jaxaEarthApi_en.ts b/i18n/jaxaEarthApi_en.ts
new file mode 100644
index 0000000..9133035
--- /dev/null
+++ b/i18n/jaxaEarthApi_en.ts
@@ -0,0 +1,70 @@
+
+
+
+
+ Dialog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JaxaEarthApiDialog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A period exceeding 1 year cannot be set.
+
+
+
+
+
+
+
+
diff --git a/i18n/jaxaEarthApi_ja.qm b/i18n/jaxaEarthApi_ja.qm
new file mode 100644
index 0000000..886c821
Binary files /dev/null and b/i18n/jaxaEarthApi_ja.qm differ
diff --git a/i18n/jaxaEarthApi_ja.ts b/i18n/jaxaEarthApi_ja.ts
new file mode 100644
index 0000000..f13c2fd
--- /dev/null
+++ b/i18n/jaxaEarthApi_ja.ts
@@ -0,0 +1,70 @@
+
+
+
+
+ Dialog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JaxaEarthApiDialog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1年を超える期間を指定することは出来ません。
+
+
+
+
+
+
+
+
diff --git a/jaxaEarthApiDialog.py b/jaxaEarthApiDialog.py
index ac80522..fb62f6a 100644
--- a/jaxaEarthApiDialog.py
+++ b/jaxaEarthApiDialog.py
@@ -274,7 +274,7 @@ def load_dataset(self):
> 365 * 24 * 60 * 60
):
QMessageBox.information(
- self, "Error", "1年を超える期間を指定することは出来ません。"
+ self, "Error", self.tr("A period exceeding 1 year cannot be set.", None)
)
return
diff --git a/jaxaEarthApiPlugin.py b/jaxaEarthApiPlugin.py
index d5b46b2..879b660 100644
--- a/jaxaEarthApiPlugin.py
+++ b/jaxaEarthApiPlugin.py
@@ -15,7 +15,7 @@
import os
# QGIS-API
-from PyQt5.QtCore import *
+from PyQt5.QtCore import QSettings, QTranslator, QCoreApplication
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from qgis.core import *
@@ -38,6 +38,17 @@ def __init__(self, iface):
self.toolbar.setObjectName(PLUGIN_NAME)
self.dialog = None
self.action = None
+ # initialize locale
+ locale = QSettings().value('locale/userLocale')[0:2]
+ locale_path = os.path.join(
+ self.plugin_dir,
+ 'i18n',
+ 'jaxaEarthApi_{}.qm'.format(locale))
+
+ if os.path.exists(locale_path):
+ self.translator = QTranslator()
+ self.translator.load(locale_path)
+ QCoreApplication.installTranslator(self.translator)
def add_action(
self,
diff --git a/jaxa_earth_api.pro b/jaxa_earth_api.pro
new file mode 100644
index 0000000..c67d402
--- /dev/null
+++ b/jaxa_earth_api.pro
@@ -0,0 +1,6 @@
+SOURCES += jaxaEarthApiPlugin.py \
+ jaxaEarthApiDialog.py
+
+FORMS += jaxaEarthApiDialog.ui
+
+TRANSLATIONS = ./i18n/jaxaEarthApi_en.ts ./i18n/jaxaEarthApi_ja.ts
\ No newline at end of file