Fix translations
Some checks failed
Gitea/kapitanbooru-uploader/pipeline/head There was a failure building this commit

This commit is contained in:
Michał Leśniak 2025-03-03 18:53:59 +01:00
parent 9361bc0363
commit fa05de8c37
6 changed files with 12 additions and 14 deletions

10
Jenkinsfile vendored
View File

@ -20,12 +20,12 @@ pipeline {
stage('Compile Translations') {
steps {
// Find all .po files under kapitanbooru_uploader/locales and compile them to .mo
sh '''
find kapitanbooru_uploader/locales -name "*.po" -print0 | while IFS= read -r -d '' po; do
mo=$(echo "$po" | sed 's/\\.po$/.mo/');
msgfmt "$po" -o "$mo";
done
find kapitanbooru_uploader/locales -name "*.po" -exec sh -c '
po="$0"
mo="${po%.po}.mo"
msgfmt "$po" -o "$mo"
' {} \;
'''
}
}

View File

@ -1,16 +1,14 @@
import gettext
import locale
import os
from typing import Dict
from importlib.resources import files
class I18N:
def __init__(self, locale_dir=None):
# If no locale_dir is provided, use the locales folder relative to this file.
if locale_dir is None:
current_dir = os.path.dirname(os.path.abspath(__file__))
locale_dir = os.path.join(current_dir, "locales")
self.locale_dir = locale_dir
locale_dir = files("kapitanbooru_uploader").joinpath("locales")
self.locale_dir = str(locale_dir)
self.languages = {"en": "English", "pl": "Polski"}
self.current_lang = "en"
self.translations: Dict[str, str] = {}

View File

@ -139,7 +139,7 @@ class ImageBrowser(tk.Tk):
super().__init__()
self.title("Kapitanbooru Uploader")
self.geometry("900x600")
self.version = "0.4.0"
self.version = "0.4.1"
self.settings = Settings()
self.tags_repo = TagsRepo(self.settings)

View File

@ -1,6 +1,6 @@
msgid ""
msgstr ""
"Project-Id-Version: Kapitanbooru Uploader 0.4.0\n"
"Project-Id-Version: Kapitanbooru Uploader 0.4.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-03-02 00:39+0100\n"
"Content-Type: text/plain; charset=UTF-8\n"

View File

@ -1,6 +1,6 @@
msgid ""
msgstr ""
"Project-Id-Version: Kapitanbooru Uploader 0.4.0\n"
"Project-Id-Version: Kapitanbooru Uploader 0.4.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-03-02 00:39+0100\n"
"Language: pl\n"

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "kapitanbooru-uploader"
version = "0.4.0"
version = "0.4.1"
description = "A GUI application for uploading images to KapitanBooru"
authors = [
{name = "Michał Leśniak", email = "kapitan@mlesniak.pl"}