Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions docs/development/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@ sudo apt install qttools5-dev-tools

## Workflow

1. Generate the `plugin_translation.pro` file:

```bash
python scripts/generate_translation_profile.py
```

1. Update `.ts` files:

```bash
pylupdate5 -verbose profile_manager/resources/i18n/plugin_translation.pro
```

2. Translate your text using QLinguist or directly into `.ts` files.
3. Compile it:
1. Translate your text using QLinguist or directly into `.ts` files. Launching it through command-line is possible:

```bash
linguist profile_manager/resources/i18n/*.ts
```

1. Compile it:

```bash
lrelease profile_manager/resources/i18n/*.ts
Expand Down
31 changes: 16 additions & 15 deletions profile_manager/profile_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QAction, QWidget

from profile_manager.__about__ import __title__, __title_clean__
from profile_manager.handlers.bookmarks import import_bookmarks
from profile_manager.handlers.customization import import_customizations
from profile_manager.handlers.data_sources import (
Expand Down Expand Up @@ -36,7 +37,7 @@
from profile_manager.profiles.utils import get_profile_qgis_ini_path, qgis_profiles_path
from profile_manager.utils import wait_cursor

LOGGER = logging.getLogger("profile_manager")
LOGGER = logging.getLogger(__title_clean__)
logging.basicConfig(
format="%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s",
datefmt="%H:%M:%S",
Expand Down Expand Up @@ -69,7 +70,7 @@ def __init__(self, iface):

# Declare instance attributes
self.action: Optional[QAction] = None
self.menu = self.tr("&Profile Manager")
self.menu = __title__

# Check if plugin was started the first time in current QGIS session
# Must be set in initGui() to survive plugin reloads
Expand All @@ -96,7 +97,7 @@ def initGui(self):
"""Create the menu entries and toolbar icons inside the QGIS GUI."""

icon = QIcon(str(self.__plugin_dir / "icon.png"))
action = QAction(icon, self.tr("Profile Manager"), self.iface.mainWindow())
action = QAction(icon, __title__, self.iface.mainWindow())
action.triggered.connect(self.run)
action.setEnabled(True)
self.iface.addToolBarIcon(action)
Expand Down Expand Up @@ -165,7 +166,7 @@ def make_backup(self, profile_name: str) -> Optional[str]:
source_path = qgis_profiles_path() / profile_name
QgsMessageLog.logMessage(
f"Backing up profile {profile_name!r} to {target_path!r}",
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand Down Expand Up @@ -234,7 +235,7 @@ def import_things(
self.tr("Importing {} data sources...").format(
sum([len(v) for v in data_sources.values()])
),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -252,7 +253,7 @@ def import_things(
if plugins:
QgsMessageLog.logMessage(
self.tr("Importing {} plugins...").format(len(plugins)),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -271,7 +272,7 @@ def import_things(
if do_import_bookmarks:
QgsMessageLog.logMessage(
self.tr("Importing bookmarks..."),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -287,7 +288,7 @@ def import_things(
if do_import_favourites:
QgsMessageLog.logMessage(
self.tr("Importing favourites..."),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -300,7 +301,7 @@ def import_things(
if do_import_models:
QgsMessageLog.logMessage(
self.tr("Importing models..."),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -313,7 +314,7 @@ def import_things(
if do_import_scripts:
QgsMessageLog.logMessage(
self.tr("Importing scripts..."),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -326,7 +327,7 @@ def import_things(
if do_import_styles:
QgsMessageLog.logMessage(
self.tr("Importing styles..."),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -339,7 +340,7 @@ def import_things(
if do_import_expressions:
QgsMessageLog.logMessage(
self.tr("Importing expressions..."),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -352,7 +353,7 @@ def import_things(
if do_import_customizations:
QgsMessageLog.logMessage(
self.tr("Importing customizations..."),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -377,7 +378,7 @@ def remove_things(
self.tr("Removing {} data sources...").format(
sum([len(v) for v in data_sources.values()])
),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand All @@ -395,7 +396,7 @@ def remove_things(
if plugins:
QgsMessageLog.logMessage(
self.tr("Removing {} plugins...").format(len(plugins)),
"Profile Manager",
__title__,
level=Qgis.MessageLevel.Info,
)
try:
Expand Down
3 changes: 3 additions & 0 deletions profile_manager/profile_manager_dialog_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Profile Manager</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
Expand Down
Loading