Compare commits

..

70 Commits

Author SHA1 Message Date
kdmukai
9588895282 bugfix 2025-04-27 13:42:06 -05:00
kdmukai
6bc1ddbac6 revert ES translations to match current dev 2025-04-27 13:42:00 -05:00
kdmukai
4201c70874 Sync to latest ES in transifex 2025-04-27 13:35:50 -05:00
kdmukai
6be95ea336 remove REPO_NAME env var; simplify html output 2025-04-27 13:32:04 -05:00
kdmukai
c6c22a176d [ES update] Additional minor changes to fit live preview screens 2025-04-27 13:29:52 -05:00
kdmukai
c98e16d5df Matches UX update to allow ANYCLICK in image entropy flow 2025-04-27 13:29:52 -05:00
kdmukai
2638c437ba latest ES translations + changes from kdmukai @ 5c6c99b 2025-04-27 13:29:52 -05:00
kdmukai
beb8981454 ES translations for final review 2025-04-27 13:29:52 -05:00
kdmukai
9f4605d876 Matching ES messages.mo for latest .po translations 2025-04-27 13:29:52 -05:00
MaxApogee
5a076ae854 Add files via upload 2025-04-27 13:29:52 -05:00
MaxApogee
7362485714 Add files via upload 2025-04-27 13:29:52 -05:00
kdmukai
b4e8074916
Merge pull request #24 from kdmukai/screenshot_diff_workflow
Remove hard-coded `kdmukai` fork reference; pass in env var instead
2025-04-27 13:15:31 -05:00
kdmukai
ec39d4cc6c Remove hard-coded kdmukai fork reference; pass in env var instead 2025-04-27 12:59:22 -05:00
kdmukai
9a6b1c1fdc Increasing sleep workaround for race condition 2025-01-01 09:21:12 -06:00
kdmukai
8856345353 Remove unused env var setup steps 2025-01-01 09:17:20 -06:00
kdmukai
cc8cce41a4 actions/checkout bumped to v4 2025-01-01 09:13:54 -06:00
kdmukai
84054bd54c Update actions versions per dbast 2024-12-31 12:18:13 -06:00
kdmukai
95c08ee850 Additional code comment 2024-12-30 14:40:40 -06:00
kdmukai
2532e2fe45 resync messages.po to current dev 2024-12-30 14:29:14 -06:00
kdmukai
6eae46c6de temp workaround to avoid race condition 2024-12-30 14:25:50 -06:00
kdmukai
5ea63c3403 html improvements 2024-12-30 14:25:50 -06:00
kdmukai
1da10668b5 Longer artifact retention, html visual improvement 2024-12-30 14:25:50 -06:00
kdmukai
5b4e13637d Add $BRANCH_NAME env var; improve html 2024-12-30 14:25:50 -06:00
kdmukai
f97bb3cb4f Use $BUILD_TAG for screenshot dir name 2024-12-30 14:25:50 -06:00
kdmukai
dfcc21a506 Pull translation updates by event type 2024-12-30 14:25:50 -06:00
kdmukai
735d85c892 re-enable checkout action for submodule 2024-12-30 14:25:50 -06:00
kdmukai
4d6ef64f8a locale bugfix, styling improvements 2024-12-30 14:25:50 -06:00
kdmukai
e3c03974d5 add diff report dir, css styling, html template 2024-12-30 14:25:50 -06:00
kdmukai
7c11b5a47a re-enable cleaning out non-diff screenshots 2024-12-30 14:25:50 -06:00
kdmukai
f9238e1934 re-enable copying changed screenshots 2024-12-30 14:25:50 -06:00
kdmukai
1298dc1ddd pip install editable 2024-12-30 14:25:50 -06:00
kdmukai
c3f876e8dd build default dev screenshots again 2024-12-30 14:25:50 -06:00
kdmukai
ee679a8019 cleanup 2024-12-30 14:25:33 -06:00
kdmukai
e3a0215869 direct clone 2024-12-30 14:25:33 -06:00
kdmukai
f913825ba6 fix artifacts path 2024-12-30 14:25:33 -06:00
kdmukai
34cd9c832a clear out translations dir 2024-12-30 14:25:33 -06:00
kdmukai
7af1edfd42 fix cwd 2024-12-30 14:25:33 -06:00
kdmukai
8c053cb76c Fix commit hash when it's a PR 2024-12-30 14:25:33 -06:00
kdmukai
2230aa4e75 simplify grabbing new translations 2024-12-30 14:25:33 -06:00
kdmukai
1b1ff87dff git fetch update 2024-12-30 14:25:33 -06:00
kdmukai
4a9861f129 git pull bugfix 2024-12-30 14:25:33 -06:00
kdmukai
3a0603c154 git clone url fix 2024-12-30 14:25:33 -06:00
kdmukai
7f3f649247 cwd bugfix 2024-12-30 14:25:33 -06:00
kdmukai
d2fb00d580 manual git calls 2024-12-30 14:25:33 -06:00
kdmukai
09482030da Add compile catalog step 2024-12-30 14:25:33 -06:00
kdmukai
cf949d2af6 don't even create the dev screenshots 2024-12-30 14:25:33 -06:00
kdmukai
6adc17b962 try removing the submodule 2024-12-30 14:25:33 -06:00
kdmukai
febcb16b06 Update .mo file! 2024-12-30 14:25:31 -06:00
kdmukai
f4bcdbcfaf another sanity check 2024-12-30 14:24:50 -06:00
kdmukai
32e74d037c sanity check 2024-12-30 14:24:50 -06:00
kdmukai
ffc5cca16e python version bugfix 2024-12-30 14:24:50 -06:00
kdmukai
2e8bb1d00c simplifying 2024-12-30 14:24:50 -06:00
kdmukai
d1546d0ee3 Remove submodule 2024-12-30 14:24:50 -06:00
kdmukai
78e59f1ff4 bugfix 2024-12-30 14:24:50 -06:00
kdmukai
990197dc87 test with translation changes 2024-12-30 14:24:49 -06:00
kdmukai
0a1f06a587 fix dev screenshots 2024-12-30 14:23:18 -06:00
kdmukai
d1dd257fd4 bugfix 2024-12-30 14:23:18 -06:00
kdmukai
58304ea073 debugging 2024-12-30 14:23:18 -06:00
kdmukai
a762233a8c debugging 2024-12-30 14:23:18 -06:00
kdmukai
ef18dd8e01 debugging 2024-12-30 14:23:18 -06:00
kdmukai
48d070723d debugging 2024-12-30 14:23:18 -06:00
kdmukai
09a6d27107 screenshot copy fix 2024-12-30 14:23:18 -06:00
kdmukai
6f74857578 debugging 2024-12-30 14:23:18 -06:00
kdmukai
d5035fe13e debugging 2024-12-30 14:23:18 -06:00
kdmukai
462bd34299 More subdir fixes 2024-12-30 14:23:18 -06:00
kdmukai
554278c8ec fix submodule subdir 2024-12-30 14:23:18 -06:00
kdmukai
bf3611a937 bugfix on submodule dir 2024-12-30 14:23:18 -06:00
kdmukai
0ec6f42d14 debugging help 2024-12-30 14:23:18 -06:00
kdmukai
983f3fdde6 Separate cleanup step 2024-12-30 14:23:18 -06:00
kdmukai
2e1f94e6ec Initial screenshot diff script and yaml 2024-12-30 14:23:18 -06:00
34 changed files with 272 additions and 32999 deletions

View File

@ -2,9 +2,9 @@
Utility to compare screenshots before and after a change and generate a report of the
differences.
Expected usage in a GitHub Actions workflow; compare `dev` with the `$INCOMING_CHANGES_REF` in the
associated PR or merge that triggered the CI run:
python src/seedsigner/resources/seedsigner-translations/.github/diff_report/diff_screenshots.py ./artifacts/dev ./artifacts/incoming ./artifacts/diff $INCOMING_CHANGES_REF
Expected usage in a GitHub Actions workflow; compare `dev` with the `$BRANCH_NAME` in the
associated PR that triggered the CI run:
python src/seedsigner/resources/seedsigner-translations/.github/diff_report/diff_screenshots.py ./artifacts/dev ./artifacts/$BRANCH_NAME ./artifacts/diff
"""
import argparse
import glob
@ -16,16 +16,15 @@ import shutil
parser = argparse.ArgumentParser(prog=__name__)
parser.add_argument("before_dir", type=str, help="Directory containing screenshots before the incoming changes")
parser.add_argument("after_dir", type=str, help="Directory containing screenshots after the incoming changes")
parser.add_argument("before_dir", type=str, help="Directory containing screenshots before the proposed changes")
parser.add_argument("after_dir", type=str, help="Directory containing screenshots after the proposed changes")
parser.add_argument("output_dir", type=str, help="Directory to save the screenshots diff report")
parser.add_argument("incoming_changes_ref", type=str, help="Branch name or commit hash that contains the incoming changes")
args = parser.parse_args()
# `before_dir` includes the branch name we'll be merging into
baseline_branch = args.before_dir.split(os.path.sep)[-1]
incoming_changes_ref = args.incoming_changes_ref
# "before" and "after" directories are named: artifacts/$TARGET_BRANCH and artifacts/$BRANCH_NAME
before_branch_name = args.before_dir.split(os.path.sep)[-1]
after_branch_name = args.after_dir.split(os.path.sep)[-1]
def list_files_recursively(path: str) -> list[str]:
""" Return a list of paths to all png files in the directory tree """
@ -92,7 +91,7 @@ for file in list_files_recursively(args.after_dir):
only_in_before = set(paths_before) - set(paths_after)
html_content = "<h1>Screenshots diff report</h1>"
html_content += f"""<p>Comparing {baseline_branch} to {incoming_changes_ref}</p>"""
html_content += f"""<p>Comparing {before_branch_name} to {after_branch_name}</p>"""
output_dir_before = os.path.join(args.output_dir, "before")
output_dir_after = os.path.join(args.output_dir, "after")
os.makedirs(output_dir_before, exist_ok=True)

View File

@ -20,9 +20,7 @@ jobs:
test:
runs-on: ubuntu-latest
env:
# head_ref: source branch name of a PR; null when action isn't a PR.
# sha: hash of a commit / merge.
INCOMING_CHANGES_REF: ${{ github.head_ref || github.sha }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout main repo 'dev'
uses: actions/checkout@v4
@ -66,17 +64,17 @@ jobs:
- name: Generate latest screenshots
run: |
rm -rf seedsigner-screenshots
mkdir -p artifacts/incoming
mkdir -p artifacts/$BRANCH_NAME
python -m pytest tests/screenshot_generator/generator.py
sleep 10
mv ./seedsigner-screenshots/* ./artifacts/incoming/
mv ./seedsigner-screenshots/* ./artifacts/$BRANCH_NAME/
- name: Diff screenshots
run: |
mkdir -p artifacts/diff
python src/seedsigner/resources/seedsigner-translations/.github/diff_report/diff_screenshots.py ./artifacts/dev ./artifacts/incoming ./artifacts/diff $INCOMING_CHANGES_REF
python src/seedsigner/resources/seedsigner-translations/.github/diff_report/diff_screenshots.py ./artifacts/dev ./artifacts/$BRANCH_NAME ./artifacts/diff
- name: Clean up artifacts
run: |
rm -rf ./artifacts/incoming
rm -rf ./artifacts/$BRANCH_NAME
rm -rf ./artifacts/dev
mv ./artifacts/diff/* ./artifacts
rmdir ./artifacts/diff

4
.gitignore vendored
View File

@ -1,5 +1 @@
.DS_Store
# Only check in *.po files since *.mo
# files can be generated from from them
*.mo

View File

@ -1,12 +0,0 @@
[main]
host = https://app.transifex.com
[o:seedsigner:p:seedsigner:r:messagespot]
file_filter = l10n/<lang>/LC_MESSAGES/messages.po
source_file = ../../../../l10n/messages.pot
type = PO
minimum_perc = 15
resource_name = messages.pot
replace_edited_strings = false
keep_translations = false
lang_map = zh-Hans: zh_Hans_CN

View File

@ -1,47 +1 @@
# SeedSigner Translations
## Transifex CLI
You can pull the latest translations directly from Transifex for all translated languages.
You'll need to create a Transifex user if you don't already have one. Your user will also
need some minimal role permissions within the SeedSigner Transifex project in order for
your user's API key to have access to the translations data.
* Install the [Transifex CLI](https://developers.transifex.com/docs/cli).
* [Create an API key](https://help.transifex.com/en/articles/6248858-generating-an-api-token)
for your Transifex user.
* From the `seedsigner/src/seedsigner/resources/seedsigner-translations` dir run:
```bash
# --force, -f Force the download of the translations files regardless of whether timestamps on the local computer are newer than those on the server (default: false)
# --all, -a Whether to download all files (default: false)
tx pull -f --all
```
* We use `-f` because as we manipulate the .po files through our PR process, they may
end up with newer timestamps even though the translation content has not changed.
That timestamp would then mislead the `tx pull` to disregard newer translations.
* Then from the SeedSigner project root, compile the catalogs to process the *.po files into
*.mo:
```bash
python setup.py compile_catalog
```
### Pulling translations for a specific language
Use the `--language, -l` flag with the `--force, -f` flag:
```bash
# Example: Spanish ("es")
tx pull -f -l es
# Or comma-separated list
tx pull -f -l pl,no
```
### Misc notes
The `.tx/config` is set to `minimum-perc = 15` (this means that the CLI will skip any
language whose translation completion falls below this minimum percentage).
You can manually override this by adding, for example, `--minimum-perc 25` to require at
least 25% translation completion.
# SeedSigner Translations

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,74 +0,0 @@
"""
Extracts all unique characters that appear in the translated strings for the specified
locale.
This is a utility for build / dev purposes only.
"""
if __name__ == "__main__":
import argparse
import os
from babel.messages import mofile
# Define required input args and help text
parser = argparse.ArgumentParser(
description="Extracts all unique characters that appear in the translated strings for the specified locale."
)
parser.usage = "python3 extract_characters_from_babel_mo.py <locale>"
parser.add_argument("locale", help="Target locale (e.g. es, pt_BR, zh_Hans_CN)")
parser.add_argument("--debug", action="store_true", help="Enable debug output")
args = parser.parse_args()
debug = args.debug
basic_chars = set((chr(c) for c in range(0x20, 0x7E + 1))) # all basic ascii chars from SPACE to "~"
mo_fullfilename = os.path.join(os.pardir, "l10n", args.locale, "LC_MESSAGES", "messages.mo")
try:
with open(mo_fullfilename, "rb") as f:
catalog = mofile.read_mo(f)
except FileNotFoundError:
print(f"Could not find translations for locale \"{args.locale}\" ({mo_fullfilename})")
exit(1)
id_chars = set()
translations_chars = set()
for msg in catalog:
if msg.id:
if isinstance(msg.id, list):
# plural message
# get chars from all plural forms
for msgid in msg.id:
id_chars.update(msgid)
else:
# singular message
id_chars.update(msg.id)
if msg.string:
if isinstance(msg.string, list):
# plural message
# get chars from all plural forms
for msgstring in msg.string:
translations_chars.update(msgstring)
else:
# singular message
translations_chars.update(msg.string)
if debug:
# Print the difference between the chars in the ids vs the basic_chars
print("Chars in ids but not in basic_chars:", sorted(set("".join(id_chars)) - set(basic_chars)))
# And show the opposite
print("Chars in basic_chars but not in ids:", sorted(basic_chars - set("".join(id_chars))))
print("Chars in translations:", "".join(sorted(translations_chars)))
# get a unique list of chars from all translation messages and included_chars string
chars = sorted(translations_chars.union(basic_chars))
# convert set to string
chars_string = "".join(chars)
# remove newlines
chars_string = chars_string.replace("\n", "").replace("\r", "")
print(chars_string)

View File

@ -1 +0,0 @@
Babel