Bump version to 0.5.1 and update localization files; update dependencies in requirements and pyproject.toml
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good
This commit is contained in:
parent
218f0b9b79
commit
56640942c8
@ -142,7 +142,7 @@ class ImageBrowser(tk.Tk):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.title("Kapitanbooru Uploader")
|
self.title("Kapitanbooru Uploader")
|
||||||
self.geometry("900x600")
|
self.geometry("900x600")
|
||||||
self.version = "0.5.0"
|
self.version = "0.5.1"
|
||||||
self.acknowledged_version = parse_version(self.version)
|
self.acknowledged_version = parse_version(self.version)
|
||||||
|
|
||||||
self.settings = Settings()
|
self.settings = Settings()
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Kapitanbooru Uploader 0.5.0\n"
|
"Project-Id-Version: Kapitanbooru Uploader 0.5.1\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: kapitan@mlesniak.pl\n"
|
||||||
"POT-Creation-Date: 2025-03-11 00:35+0100\n"
|
"POT-Creation-Date: 2025-03-15 19:42+0100\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
@ -418,6 +418,22 @@ msgstr "Error loading settings:"
|
|||||||
msgid "Błąd podczas zapisywania ustawień:"
|
msgid "Błąd podczas zapisywania ustawień:"
|
||||||
msgstr "Error saving settings:"
|
msgstr "Error saving settings:"
|
||||||
|
|
||||||
|
#: tag_processing.py:19
|
||||||
|
msgid "Błąd przy pobieraniu tagów postaci:"
|
||||||
|
msgstr "Error fetching character tags:"
|
||||||
|
|
||||||
|
#: tag_processing.py:34
|
||||||
|
msgid "Błąd przy pobieraniu tagów copyright:"
|
||||||
|
msgstr "Error fetching copyright tags:"
|
||||||
|
|
||||||
|
#: tag_processing.py:165
|
||||||
|
msgid "Błąd podczas odczytu tag_aliases:"
|
||||||
|
msgstr "Error reading tag aliases:"
|
||||||
|
|
||||||
|
#: tag_processing.py:181
|
||||||
|
msgid "Błąd podczas odczytu tags:"
|
||||||
|
msgstr "Error reading tags:"
|
||||||
|
|
||||||
#: tagger_cache.py:63
|
#: tagger_cache.py:63
|
||||||
msgid "Błąd przy odczycie cache dla"
|
msgid "Błąd przy odczycie cache dla"
|
||||||
msgstr "Error reading cache for"
|
msgstr "Error reading cache for"
|
||||||
@ -519,19 +535,3 @@ msgstr "Fetched implications for {count} tags..."
|
|||||||
#: TagsRepo.py:487
|
#: TagsRepo.py:487
|
||||||
msgid "Regeneracja bazy zakończona."
|
msgid "Regeneracja bazy zakończona."
|
||||||
msgstr "Database regeneration complete."
|
msgstr "Database regeneration complete."
|
||||||
|
|
||||||
#: tag_processing.py:19
|
|
||||||
msgid "Błąd przy pobieraniu tagów postaci:"
|
|
||||||
msgstr "Error fetching character tags:"
|
|
||||||
|
|
||||||
#: tag_processing.py:34
|
|
||||||
msgid "Błąd przy pobieraniu tagów copyright:"
|
|
||||||
msgstr "Error fetching copyright tags:"
|
|
||||||
|
|
||||||
#: tag_processing.py:165
|
|
||||||
msgid "Błąd podczas odczytu tag_aliases:"
|
|
||||||
msgstr "Error reading tag aliases:"
|
|
||||||
|
|
||||||
#: tag_processing.py:181
|
|
||||||
msgid "Błąd podczas odczytu tags:"
|
|
||||||
msgstr "Error reading tags:"
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Kapitanbooru Uploader 0.5.0\n"
|
"Project-Id-Version: Kapitanbooru Uploader 0.5.1\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: kapitan@mlesniak.pl\n"
|
||||||
"POT-Creation-Date: 2025-03-11 00:35+0100\n"
|
"POT-Creation-Date: 2025-03-15 19:42+0100\n"
|
||||||
"Language: pl\n"
|
"Language: pl\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
@ -17,7 +17,8 @@ msgstr "Błąd przy otwieraniu przeglądarki:"
|
|||||||
|
|
||||||
#: common.py:72
|
#: common.py:72
|
||||||
msgid "Login succeeded, but expected cookies were not set."
|
msgid "Login succeeded, but expected cookies were not set."
|
||||||
msgstr "Logowanie powiodło się, ale oczekiwane ciasteczka nie zostały ustawione."
|
msgstr ""
|
||||||
|
"Logowanie powiodło się, ale oczekiwane ciasteczka nie zostały ustawione."
|
||||||
|
|
||||||
#: common.py:74
|
#: common.py:74
|
||||||
msgid "Login successful. Cookies stored in session."
|
msgid "Login successful. Cookies stored in session."
|
||||||
@ -328,7 +329,7 @@ msgstr ""
|
|||||||
"Status: {status_code}\n"
|
"Status: {status_code}\n"
|
||||||
"Treść: {text}"
|
"Treść: {text}"
|
||||||
|
|
||||||
#: ImageBrowser.py:1563
|
#: ImageBrowser.py:1563 ImageBrowser.py:1566
|
||||||
msgid "Wysyłanie"
|
msgid "Wysyłanie"
|
||||||
msgstr "Wysyłanie"
|
msgstr "Wysyłanie"
|
||||||
|
|
||||||
@ -419,6 +420,22 @@ msgstr "Błąd podczas ładowania ustawień:"
|
|||||||
msgid "Błąd podczas zapisywania ustawień:"
|
msgid "Błąd podczas zapisywania ustawień:"
|
||||||
msgstr "Błąd podczas zapisywania ustawień:"
|
msgstr "Błąd podczas zapisywania ustawień:"
|
||||||
|
|
||||||
|
#: tag_processing.py:19
|
||||||
|
msgid "Błąd przy pobieraniu tagów postaci:"
|
||||||
|
msgstr "Błąd przy pobieraniu tagów postaci:"
|
||||||
|
|
||||||
|
#: tag_processing.py:34
|
||||||
|
msgid "Błąd przy pobieraniu tagów copyright:"
|
||||||
|
msgstr "Błąd przy pobieraniu tagów copyright:"
|
||||||
|
|
||||||
|
#: tag_processing.py:165
|
||||||
|
msgid "Błąd podczas odczytu tag_aliases:"
|
||||||
|
msgstr "Błąd podczas odczytu tag_aliases:"
|
||||||
|
|
||||||
|
#: tag_processing.py:181
|
||||||
|
msgid "Błąd podczas odczytu tags:"
|
||||||
|
msgstr "Błąd podczas odczytu tags:"
|
||||||
|
|
||||||
#: tagger_cache.py:63
|
#: tagger_cache.py:63
|
||||||
msgid "Błąd przy odczycie cache dla"
|
msgid "Błąd przy odczycie cache dla"
|
||||||
msgstr "Błąd przy odczycie cache dla"
|
msgstr "Błąd przy odczycie cache dla"
|
||||||
@ -520,19 +537,3 @@ msgstr "Pobrano implikacje dla {count} tagów..."
|
|||||||
#: TagsRepo.py:487
|
#: TagsRepo.py:487
|
||||||
msgid "Regeneracja bazy zakończona."
|
msgid "Regeneracja bazy zakończona."
|
||||||
msgstr "Regeneracja bazy zakończona."
|
msgstr "Regeneracja bazy zakończona."
|
||||||
|
|
||||||
#: tag_processing.py:19
|
|
||||||
msgid "Błąd przy pobieraniu tagów postaci:"
|
|
||||||
msgstr "Błąd przy pobieraniu tagów postaci:"
|
|
||||||
|
|
||||||
#: tag_processing.py:34
|
|
||||||
msgid "Błąd przy pobieraniu tagów copyright:"
|
|
||||||
msgstr "Błąd przy pobieraniu tagów copyright:"
|
|
||||||
|
|
||||||
#: tag_processing.py:165
|
|
||||||
msgid "Błąd podczas odczytu tag_aliases:"
|
|
||||||
msgstr "Błąd podczas odczytu tag_aliases:"
|
|
||||||
|
|
||||||
#: tag_processing.py:181
|
|
||||||
msgid "Błąd podczas odczytu tags:"
|
|
||||||
msgstr "Błąd podczas odczytu tags:"
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
networkx==3.4.2
|
networkx==3.4.2
|
||||||
Pillow==11.1.0
|
Pillow==11.1.0
|
||||||
pywin32==308
|
pywin32==309
|
||||||
Requests==2.32.3
|
Requests==2.32.3
|
||||||
wdtagger==0.13.2
|
wdtagger[cuda12-nightly]==0.14.0
|
||||||
bs4==0.0.2
|
bs4==0.0.2
|
||||||
tomli==2.2.1
|
tomli==2.2.1
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "kapitanbooru-uploader"
|
name = "kapitanbooru-uploader"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
description = "A GUI application for uploading images to KapitanBooru"
|
description = "A GUI application for uploading images to KapitanBooru"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Michał Leśniak", email = "kapitan@mlesniak.pl"}
|
{name = "Michał Leśniak", email = "kapitan@mlesniak.pl"}
|
||||||
@ -12,9 +12,9 @@ authors = [
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"networkx==3.4.2",
|
"networkx==3.4.2",
|
||||||
"Pillow==11.1.0",
|
"Pillow==11.1.0",
|
||||||
"pywin32==308",
|
"pywin32==309",
|
||||||
"requests==2.32.3",
|
"requests==2.32.3",
|
||||||
"wdtagger==0.13.2",
|
"wdtagger[cuda12-nightly]==0.14.0",
|
||||||
"bs4==0.0.2",
|
"bs4==0.0.2",
|
||||||
"tomli==2.2.1"
|
"tomli==2.2.1"
|
||||||
]
|
]
|
||||||
|
@ -1,19 +1,42 @@
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
:: Create POT file
|
:: Extract version from pyproject.toml
|
||||||
|
for /f "usebackq tokens=2 delims== " %%v in (`findstr /R "^version *= *" pyproject.toml`) do set VERSION=%%v
|
||||||
|
set VERSION=%VERSION:"=%
|
||||||
|
echo Detected version: %VERSION%
|
||||||
|
|
||||||
|
pushd kapitanbooru_uploader
|
||||||
|
|
||||||
|
:: 1. Delete old .pot
|
||||||
del locales\messages.pot 2>nul
|
del locales\messages.pot 2>nul
|
||||||
for %%f in (*.py) do (
|
|
||||||
if not exist locales\messages.pot (
|
:: 2. Collect all .py files into a list
|
||||||
xgettext -d messages -o locales\messages.pot "%%f"
|
set PY_FILES=
|
||||||
|
for %%f in (*.py) do set PY_FILES=!PY_FILES! "%%f"
|
||||||
|
|
||||||
|
:: 3. Generate .pot file
|
||||||
|
if defined PY_FILES (
|
||||||
|
xgettext --package-name="Kapitanbooru Uploader" --package-version="%VERSION%" -d messages -o locales\messages.pot %PY_FILES%
|
||||||
) else (
|
) else (
|
||||||
xgettext -d messages -o locales\messages.pot --join-existing "%%f"
|
echo Error: No .py files found.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
:: 4. Normalize .po headers with msgcat
|
||||||
|
for /D %%d in (locales\*) do (
|
||||||
|
if exist "%%d\LC_MESSAGES\messages.po" (
|
||||||
|
msgcat --no-location --sort-output -o "%%d\LC_MESSAGES\messages.po.new" "%%d\LC_MESSAGES\messages.po"
|
||||||
|
move /Y "%%d\LC_MESSAGES\messages.po.new" "%%d\LC_MESSAGES\messages.po"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Update PO files
|
:: 5. Force-update PO files
|
||||||
for /D %%d in (locales\*) do (
|
for /D %%d in (locales\*) do (
|
||||||
if exist "%%d\LC_MESSAGES\messages.po" (
|
if exist "%%d\LC_MESSAGES\messages.po" (
|
||||||
msgmerge --update "%%d\LC_MESSAGES\messages.po" locales\messages.pot
|
msgmerge --update --force-po --backup=none "%%d\LC_MESSAGES\messages.po" locales\messages.pot
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
popd
|
||||||
|
echo Done.
|
99
update_translations.ps1
Normal file
99
update_translations.ps1
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
# update_translations.ps1
|
||||||
|
param(
|
||||||
|
[string]$ProjectDir = "kapitanbooru_uploader"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 1. Ensure project directory exists
|
||||||
|
if (-not (Test-Path $ProjectDir)) {
|
||||||
|
Write-Host "Error: Project directory '$ProjectDir' not found." -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# 2. Extract metadata from pyproject.toml
|
||||||
|
$pyprojectPath = Join-Path -Path $PSScriptRoot -ChildPath "pyproject.toml"
|
||||||
|
$pyprojectContent = Get-Content $pyprojectPath -Raw
|
||||||
|
|
||||||
|
# Extract version
|
||||||
|
$version = [regex]::Match($pyprojectContent, 'version\s*=\s*"([^"]+)"').Groups[1].Value
|
||||||
|
|
||||||
|
# Extract author information
|
||||||
|
$authorMatch = [regex]::Match(
|
||||||
|
$pyprojectContent,
|
||||||
|
'(?s)name\s*=\s*"([^"]+)".*?email\s*=\s*"([^"]+)"'
|
||||||
|
)
|
||||||
|
$authorName = $authorMatch.Groups[1].Value.Trim()
|
||||||
|
$authorEmail = $authorMatch.Groups[2].Value.Trim()
|
||||||
|
|
||||||
|
# Extract project description
|
||||||
|
$description = [regex]::Match($pyprojectContent, 'description\s*=\s*"([^"]+)"').Groups[1].Value
|
||||||
|
$currentYear = Get-Date -Format "yyyy"
|
||||||
|
|
||||||
|
Write-Host "Detected version: $version" -ForegroundColor Cyan
|
||||||
|
|
||||||
|
# 3. Navigate to project directory (absolute path)
|
||||||
|
Push-Location (Resolve-Path $ProjectDir)
|
||||||
|
|
||||||
|
try {
|
||||||
|
# 4. Ensure locales directory exists (absolute path)
|
||||||
|
$localesDir = Join-Path -Path $pwd -ChildPath "locales"
|
||||||
|
if (-not (Test-Path $localesDir)) {
|
||||||
|
New-Item -Path $localesDir -ItemType Directory -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# 5. Define absolute path for .pot file
|
||||||
|
$potFile = Join-Path -Path $localesDir -ChildPath "messages.pot"
|
||||||
|
if (Test-Path $potFile) {
|
||||||
|
Remove-Item $potFile -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
# 6. Collect .py files with absolute paths
|
||||||
|
$pyFiles = Get-ChildItem -Filter "*.py" -File | ForEach-Object { [System.IO.Path]::GetRelativePath($pwd.ProviderPath, $_.FullName) }
|
||||||
|
|
||||||
|
# 7. Generate .pot file
|
||||||
|
xgettext `
|
||||||
|
--package-name="Kapitanbooru Uploader" `
|
||||||
|
--package-version="$version" `
|
||||||
|
--copyright-holder="$authorName" `
|
||||||
|
--msgid-bugs-address="$authorEmail" `
|
||||||
|
--add-location `
|
||||||
|
-d messages `
|
||||||
|
-o $potFile `
|
||||||
|
$pyFiles
|
||||||
|
|
||||||
|
if (-not (Test-Path $potFile)) {
|
||||||
|
Write-Host "Error: .pot file generation failed." -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# 8. Update .pot header with absolute path safety
|
||||||
|
$potContent = Get-Content $potFile -Raw
|
||||||
|
$updatedContent = $potContent `
|
||||||
|
-replace 'SOME DESCRIPTIVE TITLE', $description `
|
||||||
|
-replace 'YEAR THE PACKAGE''S COPYRIGHT HOLDER', "$currentYear $authorName" `
|
||||||
|
-replace 'FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.', "$authorName <$authorEmail>, $currentYear." `
|
||||||
|
-replace 'LANGUAGE <LL@li.org>', "Polish <$authorEmail>" `
|
||||||
|
-replace '"Language: \\n"', '"Language: en\\n"' `
|
||||||
|
-replace ', fuzzy', ''
|
||||||
|
|
||||||
|
# 9. Write back using absolute path
|
||||||
|
[System.IO.File]::WriteAllText($potFile, $updatedContent.Trim())
|
||||||
|
|
||||||
|
# 10. Update .po files
|
||||||
|
$poFiles = Get-ChildItem -Path $localesDir -Filter "messages.po" -Recurse -File
|
||||||
|
foreach ($poFile in $poFiles) {
|
||||||
|
Write-Host "Updating: $($poFile.FullName)" -ForegroundColor Yellow
|
||||||
|
msgmerge --update --backup=none $poFile.FullName $potFile
|
||||||
|
# Force Project-Id-Version update
|
||||||
|
$content = Get-Content $poFile.FullName -Raw
|
||||||
|
$updatedContent = $content -replace(
|
||||||
|
'(?s)(msgstr ""\s+"Project-Id-Version: ).*?(\\n")',
|
||||||
|
"`$1Kapitanbooru Uploader $version`$2"
|
||||||
|
)
|
||||||
|
[System.IO.File]::WriteAllText($poFile.FullName, $updatedContent.Trim())
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Done." -ForegroundColor Green
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user