Translate.py 4.15 KiB
# Translate.py -- Pamhyr
# Copyright (C) 2023-2024  INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# -*- coding: utf-8 -*-

from PyQt5.QtCore import QCoreApplication

from View.Tools.PamhyrTranslate import PamhyrTranslate

_translate = QCoreApplication.translate


class CommonWordTranslate(PamhyrTranslate):
    def __init__(self):
        super(CommonWordTranslate, self).__init__()

        self._dict["name"] = _translate("CommonWord", "Name")
        self._dict["type"] = _translate("CommonWord", "Type")
        self._dict["value"] = _translate("CommonWord", "Value")
        self._dict["comment"] = _translate("CommonWord", "Comment")
        self._dict["description"] = _translate("CommonWord", "Description")

        self._dict["time"] = _translate("CommonWord", "Time")
        self._dict["date"] = _translate("CommonWord", "Date")

        self._dict["reach"] = _translate("CommonWord", "Reach")
        self._dict["reaches"] = _translate("CommonWord", "Reaches")
        self._dict["cross_section"] = _translate("CommonWord", "Cross-section")
        self._dict["main_channel"] = _translate("CommonWord", "Main channel")
        self._dict["floodway"] = _translate("CommonWord", "Floodway")

        self._dict["not_defined"] = _translate("CommonWord", "Not defined")
        self._dict["not_associated"] = _translate(
            "CommonWord", "Not associated"
        )


class UnitTranslate(CommonWordTranslate):
    def __init__(self):
        super(UnitTranslate, self).__init__()

        self._dict["unit_rk"] = _translate("Unit", "River Kilometer (m)")
        self._dict["unit_width"] = _translate("Unit", "Width (m)")
        self._dict["unit_height"] = _translate("Unit", "Depth (m)")
        self._dict["unit_max_height"] = _translate("Unit", "Max Depth (m)")
        self._dict["unit_mean_height"] = _translate("Unit", "Mean Depth (m)")
        self._dict["unit_diameter"] = _translate("Unit", "Diameter (m)")
        self._dict["unit_thickness"] = _translate("Unit", "Thickness (m)")
        self._dict["unit_elevation"] = _translate("Unit", "Elevation (m)")
        self._dict["unit_water_elevation"] = _translate(
            "Unit", "Water elevation (m)"
        )
        self._dict["unit_speed"] = _translate("Unit", "Velocity (m/s)")
        self._dict["unit_discharge"] = _translate("Unit", "Discharge (m³/s)")
        self._dict["unit_area"] = _translate("Unit", "Area (hectare)")

        self._dict["unit_time_s"] = _translate("Unit", "Time (sec)")
        self._dict["unit_time_p"] = _translate("Unit", "Time (JJJ:HH:MM:SS)")

        self._dict["unit_date_s"] = _translate("Unit", "Date (sec)")
        self._dict["unit_date_iso"] = _translate("Unit", "Date (ISO format)")

        self._dict["unit_wet_area"] = _translate("Unit", "Wet Area (m²)")
        self._dict["unit_wet_perimeter"] = _translate(
            "Unit", "Wet Perimeter (m)"
        )
        self._dict["unit_hydraulic_radius"] = _translate(
            "Unit", "Hydraulic Radius (m)"
        )


class MainTranslate(UnitTranslate):
    def __init__(self):
        super(MainTranslate, self).__init__()

        self._dict["tab_info_name"] = _translate(
            "MainWindow", "Summary"
        )
        self._dict["tab_checker_name"] = _translate(
            "MainWindow", "Checks"
        )

        self._dict["open_debug"] = _translate(
            "MainWindow", "Open debug window"
        )
        self._dict["open_debug_sql"] = _translate(
            "MainWindow", "Open SQLite debuging tool ('sqlitebrowser')"
        )
        self._dict["active_window"] = _translate(
            "MainWindow", "Enable this window"
        )