mirror of
https://github.com/imputnet/helium.git
synced 2026-08-20 00:57:32 +02:00
Compare commits
472 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2cc325e3e2 | |||
| 857b3f7983 | |||
| b80e90ce89 | |||
| d2fae0fde2 | |||
| 4c778fcf49 | |||
| 6f09e99d9c | |||
| 0ae15ad649 | |||
| 3213f5ef95 | |||
| 63e8e1e19e | |||
| 5f6becbc1c | |||
| e2b538ad1d | |||
| 50f49b47bd | |||
| b53163d96e | |||
| 4ce588fe6c | |||
| 9e95fa429f | |||
| 57620ec7c7 | |||
| d1665c81be | |||
| 299be51690 | |||
| c50b51752e | |||
| 4db31f6fc0 | |||
| 0338d01f70 | |||
| d7fd20392c | |||
| e241025306 | |||
| 5ed12fcd18 | |||
| 3609047a12 | |||
| 6e9ce9140c | |||
| 2defeb118a | |||
| 5fac103dbf | |||
| 9094f641c9 | |||
| 22358cffac | |||
| 55b71c4b2f | |||
| 6212115c91 | |||
| 39d1887c8b | |||
| b51e059b17 | |||
| df7a042034 | |||
| a4c2225098 | |||
| ceaddaa5a5 | |||
| 1b718a766f | |||
| 32996295d5 | |||
| 90e5b02b26 | |||
| 79928ca10e | |||
| ecbcc4c141 | |||
| 8b24606c69 | |||
| a62a68ab0f | |||
| cdce7f8ce9 | |||
| a634d0dced | |||
| 45e1d81d55 | |||
| 06c960bc8d | |||
| 5de9dd1aaa | |||
| bbe89c5a2f | |||
| 74fc2911db | |||
| bf9c78f5b9 | |||
| 0c30a42e62 | |||
| 63d6642098 | |||
| 635d1c94df | |||
| 61ee27398a | |||
| 2796bdb15e | |||
| 545b86968c | |||
| 0709ab15aa | |||
| a0017b747c | |||
| 270fe307ce | |||
| f999624ca3 | |||
| a3c82120b3 | |||
| f2038df00b | |||
| 9bedc9bbc5 | |||
| 632d3a57ce | |||
| 1d6407a6ce | |||
| 08cb1ba611 | |||
| 4097abc37e | |||
| d82cfa22ed | |||
| b580fd756f | |||
| 6fda5bc707 | |||
| 68d6cf7d03 | |||
| 756a225e3a | |||
| 1bfcb15769 | |||
| 20a8a322f6 | |||
| 119f865d56 | |||
| 335b9afa20 | |||
| 1d1425f9d7 | |||
| 5069062d84 | |||
| fd0378e4f2 | |||
| dee5600297 | |||
| 2c97e8c5d1 | |||
| 81bb0219ad | |||
| a9ee371468 | |||
| 2da7804216 | |||
| 113de8e265 | |||
| 47ee4af0ff | |||
| 8030a8a305 | |||
| 1e5ae94641 | |||
| 3b015b7c65 | |||
| e695146feb | |||
| eb4d20ab67 | |||
| d703885602 | |||
| f31f77fa66 | |||
| bee47818ed | |||
| e6559b2a53 | |||
| 2adf0ad4f8 | |||
| 3d042e6224 | |||
| 6b82d3a5cb | |||
| d24193ca11 | |||
| b2a22d9d39 | |||
| 3c1fb6a950 | |||
| e7a7a5a06c | |||
| 8a04bcd160 | |||
| 88b2bb9ae0 | |||
| 68be4fc5a3 | |||
| a045cdfbc0 | |||
| 391bf50764 | |||
| 4addaf0c70 | |||
| 7e69968259 | |||
| 8aa639e550 | |||
| 75250243c5 | |||
| c0e20d7fa1 | |||
| 1a2740473b | |||
| 7d73eb9ca6 | |||
| d79d24e8a3 | |||
| 90371bd91d | |||
| f468819dc5 | |||
| e50b8bb017 | |||
| 577fb80e68 | |||
| 15e39d7790 | |||
| 9b6090c9eb | |||
| 436d84b083 | |||
| bb234e3048 | |||
| 2d89b04e1b | |||
| 0d59660e5f | |||
| 36aa5e34ae | |||
| 3b87cfd21b | |||
| 6d652dee90 | |||
| 4167eda85e | |||
| 1c614653c8 | |||
| ecb002226b | |||
| 389fe06c39 | |||
| 320bccb749 | |||
| 33ac22867a | |||
| 1c07292037 | |||
| 2420c7b531 | |||
| 8a83377c3f | |||
| 7079bcbe30 | |||
| 9d129c636f | |||
| e33c394d1d | |||
| ec0adbe698 | |||
| 9fb4aee359 | |||
| 0ecd06656c | |||
| fe345e4712 | |||
| 2aadcac1a7 | |||
| 3538f80f3e | |||
| 7545e74a59 | |||
| 65ec7ae7a9 | |||
| 6453d4baf8 | |||
| ec45bcbe8e | |||
| fd307e6b7b | |||
| e6e5cd3b34 | |||
| a175959222 | |||
| e1c55fcd73 | |||
| 47c26b8c09 | |||
| 582c023fae | |||
| 1268a6cb2b | |||
| 2f86163235 | |||
| 041b0cb4b6 | |||
| 17fc142894 | |||
| d3ba868e24 | |||
| c6feb7e095 | |||
| 03a16cfa23 | |||
| d447f8892d | |||
| 8f30897faa | |||
| c70e508bb9 | |||
| 1772f7ce56 | |||
| 7019790c7a | |||
| b65ab87b27 | |||
| 1ff4e281e6 | |||
| b71fd25a0a | |||
| 53235ce907 | |||
| 3c92902a6c | |||
| d0a8c29d38 | |||
| 2a53b77d33 | |||
| 0a4f11497b | |||
| 4848de1fc7 | |||
| e0dec3f53b | |||
| 417fa5bc7f | |||
| 7a339b3990 | |||
| 4f090cffd2 | |||
| bfe48d581a | |||
| ab214e3c94 | |||
| afa6a0592c | |||
| eba585e718 | |||
| 6ecfc9e06e | |||
| 3db87dc072 | |||
| 6bbdcc3e5e | |||
| 53deb3148a | |||
| e93aece7f5 | |||
| 629f549537 | |||
| 961c962ed4 | |||
| c96deab6c0 | |||
| 36db56b468 | |||
| 5ce006ae98 | |||
| b4c1ea62e5 | |||
| 4e5e867125 | |||
| 08a3e7dae4 | |||
| a0a5bbaf90 | |||
| c4732aacde | |||
| 11d1698665 | |||
| d820c3a286 | |||
| cf82700725 | |||
| b3cbb2baa4 | |||
| bcacb8c79e | |||
| 6b6fbd0f60 | |||
| cb3f77bdd2 | |||
| e3980159d7 | |||
| c99531d55d | |||
| c1aba0ea7c | |||
| eb6711f4ce | |||
| 6e3d516452 | |||
| 425306f53a | |||
| ae94c3c884 | |||
| 06897c1d1b | |||
| d09826d0f9 | |||
| 9aeb58daa7 | |||
| 4d7bb96593 | |||
| fa67665c5e | |||
| 6894bd30d9 | |||
| dc3fe739e6 | |||
| cbf38eb4a9 | |||
| 5bf45fed69 | |||
| 3bbe6a3ca1 | |||
| e3525bb6a5 | |||
| d48bc49673 | |||
| d4e588027a | |||
| c20175cf8b | |||
| e8a1bfc1ff | |||
| bf560c6ae7 | |||
| 34ef5f26f7 | |||
| 99cef46cfe | |||
| 5b7dd06c6f | |||
| 53ea99205f | |||
| 7a32267ee4 | |||
| d856d800ad | |||
| c362740d53 | |||
| b8a660950d | |||
| a3a5471ddf | |||
| c6a41202ce | |||
| a14223c48a | |||
| 4112ae9648 | |||
| f67a06c409 | |||
| 94344c470d | |||
| 70f4b07e91 | |||
| 672b6b286e | |||
| f050932664 | |||
| b879674d20 | |||
| d1ecca126c | |||
| e2ab1b4582 | |||
| 3f49fa539d | |||
| a7b5ed5bf1 | |||
| 95f6fe1c94 | |||
| b4155a7858 | |||
| 75bb363f0b | |||
| 9b257a50cc | |||
| 64322bef7f | |||
| 56a15e4d5d | |||
| 7c07c452ea | |||
| 5e207628bf | |||
| c44f96e128 | |||
| 65369b1a54 | |||
| d99402c696 | |||
| 0ca51e8b59 | |||
| d14e214a34 | |||
| 48eb96f4a3 | |||
| 549f912f82 | |||
| b304a82afb | |||
| 4f53b3ce3e | |||
| dca3530bdd | |||
| d028d7d459 | |||
| 1116777318 | |||
| d3c146cab1 | |||
| de395cbfc6 | |||
| 52a83d0a6f | |||
| 1884190d95 | |||
| e830f2cf55 | |||
| 245e236154 | |||
| 5fcaac214c | |||
| ac103b4708 | |||
| b48236f772 | |||
| ac87ba6409 | |||
| abe3e55672 | |||
| 118c87c414 | |||
| db09cac3d1 | |||
| 1cd894dbfb | |||
| b974f81445 | |||
| 2b78ce4852 | |||
| 06bc5f816d | |||
| 4f69833a01 | |||
| d195bfc940 | |||
| 1f2844fdf3 | |||
| 927c3f0fa3 | |||
| f5193786ab | |||
| bf15608bc3 | |||
| 75b548a5bb | |||
| 3e668c7736 | |||
| 8788c73089 | |||
| 3745a869f9 | |||
| 9a9c3c92ca | |||
| a3939ad51a | |||
| 373ca8ed20 | |||
| 8eac461288 | |||
| d105882687 | |||
| b9c270aa6b | |||
| dd1a85ca01 | |||
| 86d91a9d55 | |||
| 1d57a4d99a | |||
| ec2279d7e2 | |||
| 1ed00f0dca | |||
| 9619cf5950 | |||
| a50bc6fddd | |||
| 24d8d010d8 | |||
| 94267d333d | |||
| e6eb81ca8a | |||
| 7330d57709 | |||
| cacfef8cd3 | |||
| 9165e47027 | |||
| 347441cf8e | |||
| f247fc71fc | |||
| a3678ba9b3 | |||
| 484921bc85 | |||
| 7021065f4a | |||
| f8de630e36 | |||
| d8f9af288b | |||
| ce44c743a3 | |||
| 5eea50a9bd | |||
| 257efc8273 | |||
| 1ae83afcff | |||
| a2a555ecb1 | |||
| 0540940f93 | |||
| 7bd090f5a3 | |||
| be4a06e409 | |||
| 229dab0102 | |||
| be9a33279d | |||
| 5a10a373ae | |||
| a2193d7fd3 | |||
| bff736c0e6 | |||
| 8de63a4faf | |||
| d86fdf1798 | |||
| a867a3337c | |||
| cdbece53a3 | |||
| b4fd4a8efe | |||
| a0780eb1ed | |||
| 458bee8ece | |||
| 99c9e18b3c | |||
| f669ff5210 | |||
| 40d47da6e6 | |||
| d8ced84df9 | |||
| 8810266377 | |||
| 8591b4488a | |||
| 2b77669c77 | |||
| 64a8a04761 | |||
| 4864f1010e | |||
| b95aacd03b | |||
| 18d41fefa8 | |||
| b91da86c49 | |||
| 69ce5c0207 | |||
| 419f7fb6d4 | |||
| aca8a005a2 | |||
| 152d74a019 | |||
| ae72b022a2 | |||
| 39bf3f48d2 | |||
| e4fe9b15bb | |||
| 3c1b040a08 | |||
| 4207bd0e22 | |||
| 53ff75eb2f | |||
| 567d02d22b | |||
| b4b060a3cb | |||
| 6b900835b4 | |||
| 79784c93d3 | |||
| d0ba605ba3 | |||
| 67ea7682cc | |||
| da04702c97 | |||
| 9cbad6bf52 | |||
| 1594bc730b | |||
| d66528afde | |||
| 0eea8e66f0 | |||
| f23a9e6f66 | |||
| 3c33a6b8f1 | |||
| f532f0167c | |||
| 2036f3452a | |||
| d2c3aa41a7 | |||
| 8d105f8cb1 | |||
| a2fb72f955 | |||
| 6b19ea4ee3 | |||
| 386150eb0f | |||
| 1e21aad1f6 | |||
| e67e814520 | |||
| 177d9c0169 | |||
| 1af0b6e799 | |||
| 90223b1061 | |||
| 4ccd99fa8c | |||
| 1a45aa12b1 | |||
| ea84198185 | |||
| 7e663390f7 | |||
| 95d5228118 | |||
| be3d15c701 | |||
| b42072d439 | |||
| dbb3920c69 | |||
| bec06c7293 | |||
| c7f631783e | |||
| d74e8d8f3a | |||
| fd57953cac | |||
| 81ef6ec47e | |||
| 14244bc012 | |||
| f3852d835d | |||
| a4d7bc81ce | |||
| 14ec637b77 | |||
| 5e21690e93 | |||
| d74f54bb06 | |||
| 88c004062e | |||
| 5085b57781 | |||
| 9dc3fd3afe | |||
| 407af114a5 | |||
| 12fd67f867 | |||
| 4f893d8c1f | |||
| 037777dabc | |||
| f8acdbd219 | |||
| 9dade90275 | |||
| 18ce51bd26 | |||
| e6876c49a2 | |||
| d71606d95a | |||
| d4adf3d4df | |||
| c36117faae | |||
| b989152c44 | |||
| e01ab553ef | |||
| 378d796d0e | |||
| 0cfb8c7de2 | |||
| 12530a3603 | |||
| e539a62d9f | |||
| 2fa3c60d40 | |||
| 0f4be4b6d8 | |||
| dffd782f82 | |||
| 9e36d0ca4d | |||
| 3a30eab69c | |||
| 2e7a95fdf3 | |||
| 2cb24455b2 | |||
| ed128a3df2 | |||
| be9a36f80b | |||
| ab91f25f9b | |||
| bad019b5fd | |||
| 4916f0e5a6 | |||
| 8bf0059e93 | |||
| a2f9bcb1d4 | |||
| 56ac86df74 | |||
| 48cabdeaad | |||
| e4939fdf70 | |||
| b3a54ca19a | |||
| ca5a83f932 | |||
| a1f1902737 | |||
| 2002f79e6e | |||
| 14b782216f | |||
| 22c639a415 | |||
| 4f9db87a9f | |||
| 3465e69582 | |||
| 580180d0f2 | |||
| 8c806c4e23 | |||
| d96848ea9a | |||
| b5dd268005 | |||
| 51d60a2f13 | |||
| 69c87d60f1 | |||
| 603b96d4de | |||
| 9b214c030a | |||
| e24bdcf9b7 | |||
| 376aa15768 | |||
| 6c96742fc2 | |||
| 2350d3e669 | |||
| 9805b3260c | |||
| 33f864e2ef |
-66
@@ -1,66 +0,0 @@
|
||||
env:
|
||||
CIRRUS_CLONE_DEPTH: 1
|
||||
|
||||
container:
|
||||
dockerfile: .cirrus_Dockerfile
|
||||
cpu: 8
|
||||
memory: 32G
|
||||
use_in_memory_disk: true
|
||||
|
||||
code_check_task:
|
||||
pip_cache:
|
||||
folder: /usr/local/lib/python3.10/site-packages
|
||||
fingerprint_script: cat .cirrus_requirements.txt
|
||||
populate_script: python3 -m ensurepip && pip install -r .cirrus_requirements.txt
|
||||
utils_script:
|
||||
- python3 -m yapf --style '.style.yapf' -e '*/third_party/*' -rpd utils
|
||||
- ./devutils/run_utils_pylint.py --hide-fixme
|
||||
- ./devutils/run_utils_tests.sh
|
||||
devutils_script:
|
||||
- python3 -m yapf --style '.style.yapf' -e '*/third_party/*' -rpd devutils
|
||||
- ./devutils/run_devutils_pylint.py --hide-fixme
|
||||
- ./devutils/run_devutils_tests.sh
|
||||
|
||||
validate_config_task:
|
||||
validate_config_script: ./devutils/validate_config.py
|
||||
|
||||
validate_with_source_task:
|
||||
pip_cache:
|
||||
folder: /usr/local/lib/python3.10/site-packages
|
||||
fingerprint_script: cat .cirrus_requirements.txt
|
||||
populate_script: python3 -m ensurepip && pip install -r .cirrus_requirements.txt
|
||||
chromium_download_script: |
|
||||
# These directories will not exist when this is called, unless cache retrieval
|
||||
# fails and leaves partially-complete files around.
|
||||
rm -rf chromium_src
|
||||
rm -rf chromium_download_cache
|
||||
mkdir chromium_download_cache
|
||||
# Attempt to download tarball
|
||||
./utils/downloads.py retrieve -i deps.ini -c chromium_download_cache &
|
||||
if ! ./utils/downloads.py retrieve -i downloads.ini -c chromium_download_cache ; then
|
||||
# If tarball is not available, attempt a clone
|
||||
./utils/clone.py -o chromium_src
|
||||
rm -rf chromium_src/uc_staging
|
||||
find chromium_src -type d -name '.git' -exec rm -rf "{}" \; -prune
|
||||
tar cf chromium_download_cache/chromium-$(cat chromium_version.txt)-lite.tar.xz \
|
||||
--transform s/chromium_src/chromium-$(cat chromium_version.txt)/ chromium_src
|
||||
fi
|
||||
wait
|
||||
unpack_source_script: |
|
||||
if [ ! -d chromium_src ]; then
|
||||
./utils/downloads.py unpack -i downloads.ini -c chromium_download_cache chromium_src
|
||||
fi
|
||||
./utils/downloads.py unpack -i deps.ini -c chromium_download_cache chromium_src
|
||||
validate_patches_script:
|
||||
- ./devutils/validate_patches.py -l chromium_src -v
|
||||
validate_lists_script: |
|
||||
set -e
|
||||
./devutils/update_lists.py \
|
||||
--tree chromium_src \
|
||||
--pruning pruning.list.gen \
|
||||
--domain-substitution domain_substitution.list.gen \
|
||||
--no-error-unused
|
||||
diff pruning.list pruning.list.gen
|
||||
diff domain_substitution.list domain_substitution.list.gen
|
||||
|
||||
# vim: set expandtab shiftwidth=4 softtabstop=4:
|
||||
@@ -44,6 +44,11 @@ body:
|
||||
description: A clear and concise description (in one line) of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: crashid
|
||||
attributes:
|
||||
label: Crash ID
|
||||
description: If applicable, provide the crash ID from helium://crashes.
|
||||
- type: textarea
|
||||
id: repro
|
||||
attributes:
|
||||
|
||||
@@ -69,7 +69,17 @@ runs:
|
||||
|
||||
mkdir -p build/{src,download_cache}
|
||||
|
||||
for file in "$HELIUM_DIR/downloads.ini" "$HELIUM_DIR/deps.ini" "$PLATFORM_DIR/downloads.ini"; do
|
||||
if ! run_upstream utils/downloads.py retrieve \
|
||||
-i "$HELIUM_DIR/downloads.ini" -c build/download_cache; then
|
||||
run_upstream utils/clone.py -o build/src
|
||||
fi
|
||||
|
||||
if [ ! -d build/src/chrome ]; then
|
||||
run_upstream utils/downloads.py unpack \
|
||||
-i "$HELIUM_DIR/downloads.ini" -c build/download_cache build/src
|
||||
fi
|
||||
|
||||
for file in "$HELIUM_DIR/deps.ini" "$PLATFORM_DIR/downloads.ini"; do
|
||||
if ! [ -f "$file" ]; then continue; fi
|
||||
|
||||
run_upstream utils/downloads.py retrieve \
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
name: CI setup
|
||||
description: Shared setup for CI jobs
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version-file: .python-version
|
||||
cache: pip
|
||||
cache-dependency-path: .cirrus_requirements.txt
|
||||
|
||||
- name: Install runner packages
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends xz-utils patch curl git
|
||||
|
||||
- name: Install Python dependencies
|
||||
shell: bash
|
||||
run: python -m pip install -r .cirrus_requirements.txt
|
||||
@@ -21,7 +21,7 @@ def main():
|
||||
if '/translations/' not in path:
|
||||
continue
|
||||
lang = path.split('/')[-1].removesuffix('.json')
|
||||
for user in owners.get(lang, []):
|
||||
for user in owners.get(lang) or []:
|
||||
mentions.add(f'@{user}')
|
||||
|
||||
if mentions:
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
name: Code Validation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
code-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up CI environment
|
||||
uses: ./.github/actions/ci-setup
|
||||
|
||||
- name: Format utils
|
||||
run: python -m yapf --style .style.yapf -e '*/third_party/*' -rpd utils
|
||||
|
||||
- name: Lint utils
|
||||
run: ./devutils/run_utils_pylint.py --hide-fixme
|
||||
|
||||
- name: Test utils
|
||||
run: ./devutils/run_utils_tests.sh
|
||||
|
||||
- name: Format devutils
|
||||
run: python -m yapf --style .style.yapf -e '*/third_party/*' -rpd devutils
|
||||
|
||||
- name: Lint devutils
|
||||
run: ./devutils/run_devutils_pylint.py --hide-fixme
|
||||
|
||||
- name: Test devutils
|
||||
run: ./devutils/run_devutils_tests.sh
|
||||
|
||||
validate-config:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up CI environment
|
||||
uses: ./.github/actions/ci-setup
|
||||
|
||||
- name: Validate repository configuration
|
||||
run: ./devutils/validate_config.py
|
||||
|
||||
validate-with-source:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up CI environment
|
||||
uses: ./.github/actions/ci-setup
|
||||
|
||||
- name: Restore Chromium download cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: chromium_download_cache
|
||||
key: ${{ runner.os }}-chromium-download-cache-${{ hashFiles('chromium_version.txt', 'downloads.ini', 'deps.ini') }}
|
||||
|
||||
- name: Retrieve Chromium source archive
|
||||
run: |
|
||||
rm -rf chromium_src
|
||||
mkdir -p chromium_download_cache
|
||||
|
||||
./utils/downloads.py retrieve -i deps.ini -c chromium_download_cache &
|
||||
DEPS_PID=$!
|
||||
|
||||
if ! ./utils/downloads.py retrieve -i downloads.ini -c chromium_download_cache; then
|
||||
./utils/clone.py -o chromium_src
|
||||
rm -rf chromium_src/uc_staging
|
||||
find chromium_src -type d -name '.git' -exec rm -rf "{}" \; -prune
|
||||
tar cf "chromium_download_cache/chromium-$(cat chromium_version.txt)-lite.tar.xz" \
|
||||
--transform "s/chromium_src/chromium-$(cat chromium_version.txt)/" chromium_src
|
||||
fi
|
||||
|
||||
wait "$DEPS_PID"
|
||||
|
||||
- name: Unpack Chromium source archive
|
||||
run: |
|
||||
if [ ! -d chromium_src ]; then
|
||||
./utils/downloads.py unpack -i downloads.ini -c chromium_download_cache chromium_src
|
||||
fi
|
||||
./utils/downloads.py unpack -i deps.ini -c chromium_download_cache chromium_src
|
||||
|
||||
- name: Validate patches
|
||||
run: ./devutils/validate_patches.py -l chromium_src -v
|
||||
|
||||
- name: Restore generated source file lists
|
||||
id: source-file-lists-cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
pruning.list.gen
|
||||
domain_substitution.list.gen
|
||||
# Deliberately exclude the checked-in lists so changes to them are
|
||||
# still validated against the previously generated results.
|
||||
key: >-
|
||||
${{ runner.os }}-source-file-lists-v1-${{
|
||||
hashFiles(
|
||||
'.python-version',
|
||||
'chromium_version.txt',
|
||||
'downloads.ini',
|
||||
'deps.ini',
|
||||
'domain_regex.list',
|
||||
'devutils/update_lists.py',
|
||||
'utils/domain_substitution.py',
|
||||
'utils/prune_binaries.py'
|
||||
)
|
||||
}}
|
||||
|
||||
- name: Generate source file lists
|
||||
if: steps.source-file-lists-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
./devutils/update_lists.py \
|
||||
--tree chromium_src \
|
||||
--pruning pruning.list.gen \
|
||||
--domain-substitution domain_substitution.list.gen \
|
||||
--no-error-unused
|
||||
|
||||
- name: Validate source file lists
|
||||
run: |
|
||||
diff -u pruning.list pruning.list.gen
|
||||
diff -u domain_substitution.list domain_substitution.list.gen
|
||||
@@ -1,13 +0,0 @@
|
||||
name: cirrus
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
cirrus:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cirruslabs/cirrus-action@ac5191d18a9bff05ff1a38f280f2b6d768e32153
|
||||
@@ -11,6 +11,8 @@ permissions:
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
# skip if the PR is from a fork
|
||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR: ${{ github.event.pull_request.number }}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
3.10
|
||||
@@ -1 +1 @@
|
||||
147.0.7727.55
|
||||
151.0.7922.169
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
# Everything that's downloaded after cloning Chromium goes here.
|
||||
# It will not work from main downloads.ini
|
||||
[search_engines_data]
|
||||
url = https://gist.githubusercontent.com/wukko/2a591364dda346e10219e4adabd568b1/raw/e75ae3c4a1ce940ef7627916a48bc40882d24d40/nonfree-search-engines-data.tar.gz
|
||||
download_filename = nonfree-search-engines-data.tar.gz
|
||||
sha256 = 00a87050fa3f941d04d67fb5763991e0b8ea399a88b505ab0e56dd263f06864c
|
||||
version = 202607242007
|
||||
url = https://github.com/imputnet/helium-nonfree-assets/releases/download/%(version)s/nonfree-search-engines-data-%(version)s.tar.gz
|
||||
download_filename = nonfree-search-engines-data-%(version)s.tar.gz
|
||||
sha256 = e14fa5b38ced15ae516143da23edcba608eea63e54960173ae8829f08efffb58
|
||||
output_path = ./third_party/search_engines_data/resources_internal
|
||||
|
||||
[onboarding]
|
||||
version = 202603080703
|
||||
version = 202607301504
|
||||
url = https://github.com/imputnet/helium-onboarding/releases/download/%(version)s/helium-onboarding-%(version)s.tar.gz
|
||||
download_filename = onboarding-page-%(version)s.tar.gz
|
||||
sha256 = 6883e90d7bdca572a37fa584dbc60504d5f2072a399daf58cdc3d1c9764eb508
|
||||
sha256 = da303b99461c92464f07b6bed67166c2d372abaf9b3a09bb73e3864d0cbe690a
|
||||
output_path = ./components/helium_onboarding
|
||||
|
||||
# If you are bumping this, you *NEED* to re-strip the assets.json
|
||||
# file *every time* by using `devutils/clear-ublock-assets.js`.
|
||||
[ublock_origin]
|
||||
version = 1.70.0
|
||||
version = 1.73.0
|
||||
url = https://github.com/imputnet/uBlock/releases/download/%(version)s/uBlock0_%(version)s.chromium.zip
|
||||
sha256 = d36ad2515c8dac907d17ae56d015c91c97fe27980fca1dc7575d0dfdba68e0d4
|
||||
sha256 = 28a2cfc06412cf6b0d2ec8dfbc40c7db731a3324d171497c919433c59c272ae9
|
||||
download_filename = ublock-origin-%(version)s.zip
|
||||
output_path = third_party/ublock
|
||||
strip_leading_dirs = uBlock0.chromium
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Wrapper for devutils and utils formatter, linter, and tester
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ def check_downloads_ini(downloads_ini_iter):
|
||||
|
||||
downloads_ini_iter must be an iterable of strings to downloads.ini files.
|
||||
|
||||
Returns True if errors occured, False otherwise.
|
||||
Returns True if errors occurred, False otherwise.
|
||||
"""
|
||||
try:
|
||||
DownloadInfo(downloads_ini_iter)
|
||||
|
||||
@@ -52,7 +52,7 @@ def check_patch_readability(patches_dir, series_path=Path('series')):
|
||||
Check if the patches from iterable patch_path_iter are readable.
|
||||
Patches that are not are logged to stdout.
|
||||
|
||||
Returns True if warnings occured, False otherwise.
|
||||
Returns True if warnings occurred, False otherwise.
|
||||
"""
|
||||
warnings = False
|
||||
for patch_path in _read_series_file(patches_dir, series_path, join_dir=True):
|
||||
|
||||
@@ -47,6 +47,20 @@ def parse_args():
|
||||
type=Path,
|
||||
help='Import translations from a JSON file '
|
||||
'instead of calling the LLM.')
|
||||
translate.add_argument('--cmd',
|
||||
help='Run translations through this command instead of '
|
||||
'the LLM completions API. The filled prompt is appended '
|
||||
'as the final argument and the JSON payload is passed '
|
||||
'on stdin.')
|
||||
|
||||
subparsers.add_parser('clean', help='Clean up stale translation strings')
|
||||
|
||||
forage = subparsers.add_parser('forage', help='Find existing translation strings in Chromium')
|
||||
forage.add_argument('-t',
|
||||
'--tree',
|
||||
type=Path,
|
||||
required=True,
|
||||
help='Path to Chromium source tree')
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
@@ -63,6 +77,14 @@ def main():
|
||||
import i18n_translate # pylint: disable=import-outside-toplevel
|
||||
return i18n_translate.run(args)
|
||||
|
||||
if args.command == 'clean':
|
||||
import i18n_clean # pylint: disable=import-outside-toplevel
|
||||
return i18n_clean.run()
|
||||
|
||||
if args.command == 'forage':
|
||||
import i18n_forage # pylint: disable=import-outside-toplevel
|
||||
return i18n_forage.run(args)
|
||||
|
||||
raise ValueError(f'unknown command: {args.command}')
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
# Copyright 2026 The Helium Authors
|
||||
# You can use, redistribute, and/or modify this source code under
|
||||
# the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
"""Helper for cleaning up obsolete and outdated translation strings."""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
I18N_DIR = Path(__file__).resolve().parent.parent / 'i18n'
|
||||
SOURCE_PATH = I18N_DIR / 'source.gen.json'
|
||||
TRANSLATIONS_DIR = I18N_DIR / 'translations'
|
||||
|
||||
|
||||
def clean_translation_file(lang, source_keys):
|
||||
"""Clean up outdated and duplicated translations in a language file."""
|
||||
path = TRANSLATIONS_DIR / f'{lang}.json'
|
||||
with open(path, encoding='utf-8') as file:
|
||||
entries = json.load(file)
|
||||
|
||||
translation_keys = set()
|
||||
result = []
|
||||
n_filtered = 0
|
||||
for entry in entries:
|
||||
key = (entry['name'], entry['source'])
|
||||
if key in source_keys and key not in translation_keys:
|
||||
result.append(entry)
|
||||
translation_keys.add(key)
|
||||
else:
|
||||
n_filtered += 1
|
||||
|
||||
if n_filtered > 0:
|
||||
with open(path, 'w', encoding='utf-8') as file:
|
||||
json.dump(result, file, indent=2, ensure_ascii=False)
|
||||
file.write('\n')
|
||||
|
||||
return n_filtered
|
||||
|
||||
|
||||
def run():
|
||||
"""Clean up outdated translation strings."""
|
||||
with open(SOURCE_PATH, encoding='utf-8') as file:
|
||||
source = json.load(file)
|
||||
with open(I18N_DIR / 'languages.json', encoding='utf-8') as file:
|
||||
languages = json.load(file)
|
||||
|
||||
existing_keys = set()
|
||||
for entry in source:
|
||||
existing_keys.add((entry['name'], entry['message']))
|
||||
|
||||
for lang in languages:
|
||||
n_filtered = clean_translation_file(lang, existing_keys)
|
||||
if n_filtered:
|
||||
print(f'{lang}: filtered {n_filtered} string(s)')
|
||||
@@ -0,0 +1,111 @@
|
||||
# Copyright 2026 The Helium Authors
|
||||
# You can use, redistribute, and/or modify this source code under
|
||||
# the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
"""Helper for finding existing translated strings in upstream Chromium."""
|
||||
|
||||
import sys
|
||||
import json
|
||||
from pathlib import Path
|
||||
from collections import defaultdict
|
||||
import xml.etree.ElementTree as xml
|
||||
|
||||
I18N_DIR = Path(__file__).resolve().parent.parent / 'i18n'
|
||||
SOURCE_PATH = I18N_DIR / 'source.gen.json'
|
||||
TRANSLATIONS_DIR = I18N_DIR / 'translations'
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'utils'))
|
||||
from i18n_apply import get_id, build_xtb_index, resolve_xtb
|
||||
import name_substitution_utils as namesub
|
||||
|
||||
|
||||
def get_untranslated_strings_by_xtb(source, lang, xtb_index):
|
||||
"""Generates a map of xtb_path -> [untranslated strings]."""
|
||||
translation_path = TRANSLATIONS_DIR / f'{lang}.json'
|
||||
trans_keys = set()
|
||||
|
||||
if translation_path.exists():
|
||||
with open(translation_path, encoding='utf-8') as file:
|
||||
translations = json.load(file)
|
||||
for translation in translations:
|
||||
trans_keys.add((translation['name'], translation['source']))
|
||||
|
||||
filtered = defaultdict(list)
|
||||
for string in source:
|
||||
xtb_file = resolve_xtb(string, lang, xtb_index)
|
||||
assert xtb_file is not None
|
||||
if (string['name'], string['message']) not in trans_keys:
|
||||
filtered[xtb_file].append(string)
|
||||
return filtered
|
||||
|
||||
|
||||
def to_fpmap(strings):
|
||||
"""Generates a fingerprint -> source string mapping."""
|
||||
fp_map = {}
|
||||
for string in strings:
|
||||
fingerprint = get_id(string['name'], string['context'], string['message'],
|
||||
string.get('meaning'))
|
||||
fp_map[fingerprint] = string
|
||||
return fp_map
|
||||
|
||||
|
||||
def stringify_inner_xml(node):
|
||||
"""Takes an XML node and stringifies its inner contents."""
|
||||
parts = [node.text or '']
|
||||
for child in node:
|
||||
parts.append(xml.tostring(child, encoding='unicode'))
|
||||
return ''.join(parts)
|
||||
|
||||
|
||||
def find_matching(path, fpmap):
|
||||
"""Finds pre-existing matching translations for Helium strings."""
|
||||
content = path.read_text(encoding='utf-8')
|
||||
root = xml.fromstring(content)
|
||||
|
||||
out = {}
|
||||
for node in root.findall('.//translation'):
|
||||
fingerprint = node.get('id')
|
||||
if fingerprint in fpmap:
|
||||
out[fingerprint] = stringify_inner_xml(node)
|
||||
return out
|
||||
|
||||
|
||||
def apply_matching(lang, matching, fpmap):
|
||||
"""
|
||||
Takes a map of found matches and applies them to the helium i18n file.
|
||||
"""
|
||||
translation_path = TRANSLATIONS_DIR / f'{lang}.json'
|
||||
translations = []
|
||||
if translation_path.exists():
|
||||
with open(translation_path, encoding='utf-8') as file:
|
||||
translations = json.load(file)
|
||||
|
||||
for fingerprint, translation in matching.items():
|
||||
original = fpmap[fingerprint]
|
||||
translations.append({
|
||||
'name': namesub.replace_text(original['name'])[0],
|
||||
'source': namesub.replace_text(original['message'])[0],
|
||||
'message': namesub.replace_text(translation)[0],
|
||||
})
|
||||
|
||||
with open(translation_path, 'w', encoding='utf-8') as file:
|
||||
json.dump(translations, file, indent=2, ensure_ascii=False)
|
||||
file.write('\n')
|
||||
|
||||
|
||||
def run(args):
|
||||
"""Forages for usable existing Chromium translations."""
|
||||
with open(SOURCE_PATH, encoding='utf-8') as file:
|
||||
source = json.load(file)
|
||||
with open(I18N_DIR / 'languages.json', encoding='utf-8') as file:
|
||||
languages = json.load(file)
|
||||
|
||||
namesub.add_grit_to_path(args.tree)
|
||||
xtb_map = build_xtb_index(source, args.tree)
|
||||
|
||||
for lang in languages:
|
||||
missing = get_untranslated_strings_by_xtb(source, lang, xtb_map)
|
||||
for path, strings in missing.items():
|
||||
fpmap = to_fpmap(strings)
|
||||
matching = find_matching(path, fpmap)
|
||||
if matching:
|
||||
apply_matching(lang, matching, fpmap)
|
||||
+60
-26
@@ -7,30 +7,46 @@ String extraction from Helium patches for translation.
|
||||
|
||||
import subprocess
|
||||
import json
|
||||
import sys
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from third_party import unidiff
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'utils'))
|
||||
|
||||
from downloads import DownloadInfo # pylint: disable=wrong-import-order
|
||||
import utils.name_substitution_utils as namesub # pylint: disable=wrong-import-order
|
||||
|
||||
PLATFORMS = ("windows", "macos", "linux")
|
||||
REPO_URL = "https://github.com/imputnet/helium-{platform}.git"
|
||||
REPO_URL = "https://github.com/imputnet/helium-{repo}.git"
|
||||
ROOT_DIR = Path(__file__).resolve().parent.parent
|
||||
ONBOARDING_VERSION = DownloadInfo([ROOT_DIR / "deps.ini"])['onboarding'].version
|
||||
|
||||
|
||||
def get_xml_attr(text, attr):
|
||||
"""Extract an XML attribute from an opening tag."""
|
||||
match = re.search(rf'{attr}="([^"]*)"', text)
|
||||
return match.group(1) if match else None
|
||||
|
||||
|
||||
def prep_platform_repos(platforms_dir):
|
||||
"""Clone and update platform repos into the given directory."""
|
||||
platforms_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for platform in PLATFORMS:
|
||||
dest = platforms_dir / platform
|
||||
for repo in list(PLATFORMS) + ["onboarding"]:
|
||||
dest = platforms_dir / repo
|
||||
if not dest.is_dir():
|
||||
subprocess.run(
|
||||
["git", "clone", REPO_URL.format(platform=platform),
|
||||
["git", "clone", REPO_URL.format(repo=repo),
|
||||
str(dest)],
|
||||
check=True,
|
||||
)
|
||||
subprocess.check_call(["git", "-C", str(dest), "checkout", "main"])
|
||||
subprocess.check_call(["git", "-C", str(dest), "pull"])
|
||||
subprocess.check_call(["git", "-C", str(dest), "fetch"])
|
||||
subprocess.check_call([
|
||||
"git", "-C",
|
||||
str(dest), "checkout", ONBOARDING_VERSION if repo == "onboarding" else "origin/main"
|
||||
])
|
||||
|
||||
|
||||
def get_patch_paths(repo_root, platforms_dir):
|
||||
@@ -58,9 +74,9 @@ def get_relevant_patches(repo_root, platforms_dir):
|
||||
yield file
|
||||
|
||||
|
||||
def extract_strings_from_hunk(hunk):
|
||||
def extract_strings_from_hunk(hunk, clean=False):
|
||||
"""
|
||||
Parse a diff hunk and generate (name, desc, message)
|
||||
Parse a diff hunk and generate (name, desc, meaning, message)
|
||||
for added GRD message elements.
|
||||
|
||||
What we want:
|
||||
@@ -71,50 +87,68 @@ def extract_strings_from_hunk(hunk):
|
||||
- broken chunks of untouched, pre-existing units
|
||||
- units that were added in a different patch (avoiding duplication)
|
||||
"""
|
||||
name, message, desc = None, '', None
|
||||
name, message, desc, meaning = None, '', None, None
|
||||
meta_acc = ''
|
||||
had_any_additive = False
|
||||
|
||||
for line in str(hunk).split('\n'):
|
||||
is_additive = line.startswith('+')
|
||||
is_additive = line.startswith('+') or clean
|
||||
is_subtractive = line.startswith('-')
|
||||
line = line.lstrip('+').strip()
|
||||
line = line.lstrip('+')
|
||||
|
||||
if is_subtractive:
|
||||
continue
|
||||
if not name:
|
||||
line = line.strip()
|
||||
|
||||
if line.startswith('<message') or meta_acc:
|
||||
meta_acc += line
|
||||
elif line.startswith('</message>'):
|
||||
elif '</message>' in line:
|
||||
if name and message and had_any_additive:
|
||||
yield name, desc, message
|
||||
name, message, desc = None, '', None
|
||||
yield name, desc, meaning, message.strip()
|
||||
name, message, desc, meaning = None, '', None, None
|
||||
had_any_additive = False
|
||||
elif name:
|
||||
message += line
|
||||
message += line + '\n'
|
||||
|
||||
if meta_acc and line.endswith('>'):
|
||||
name = meta_acc.split('name="')[1].split('"')[0]
|
||||
desc = meta_acc.split('desc="')[1].split('"')[0]
|
||||
name = get_xml_attr(meta_acc, 'name')
|
||||
desc = get_xml_attr(meta_acc, 'desc')
|
||||
meaning = get_xml_attr(meta_acc, 'meaning')
|
||||
meta_acc = ''
|
||||
|
||||
had_any_additive |= bool(name) and is_additive
|
||||
|
||||
|
||||
def to_source_format(path, name, desc, meaning, message):
|
||||
"""Takes an extracted XML tuple and converts it to the JSON format."""
|
||||
context = namesub.replace_text(desc)[0]
|
||||
message = namesub.replace_text(message)[0]
|
||||
|
||||
entry = {
|
||||
'name': name,
|
||||
'source': path,
|
||||
'context': context,
|
||||
}
|
||||
if meaning:
|
||||
entry['meaning'] = namesub.replace_text(meaning)[0]
|
||||
entry['message'] = message
|
||||
yield entry
|
||||
|
||||
|
||||
def extract_strings(repo_root, platforms_dir):
|
||||
"""Generate strings to be translated for all grit strings in patches."""
|
||||
for patch in get_relevant_patches(repo_root, platforms_dir):
|
||||
for hunk in patch:
|
||||
for name, desc, message in extract_strings_from_hunk(hunk):
|
||||
context = namesub.replace_text(desc)[0]
|
||||
message = namesub.replace_text(message)[0]
|
||||
for source in extract_strings_from_hunk(hunk):
|
||||
yield from to_source_format(patch.path, *source)
|
||||
|
||||
yield {
|
||||
'name': name,
|
||||
'source': patch.path,
|
||||
'context': context,
|
||||
'message': message,
|
||||
}
|
||||
onboarding_path = platforms_dir / "onboarding" / "helium_onboarding_strings.grdp"
|
||||
if onboarding_path.exists():
|
||||
onboarding_text = onboarding_path.read_text()
|
||||
for source in extract_strings_from_hunk(onboarding_text, True):
|
||||
yield from to_source_format(
|
||||
'components/helium_onboarding/helium_onboarding_strings.grdp', *source)
|
||||
|
||||
|
||||
def run(args, repo_root):
|
||||
|
||||
+37
-2
@@ -11,6 +11,35 @@ from pathlib import Path
|
||||
|
||||
I18N_DIR = Path(__file__).resolve().parent.parent / 'i18n'
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'utils'))
|
||||
from i18n_apply import to_xtb_message # pylint: disable=wrong-import-position
|
||||
|
||||
sys.path.pop(0)
|
||||
|
||||
|
||||
def get_placeholders(root):
|
||||
"""Return placeholder names and argument bindings, ignoring their order."""
|
||||
return sorted((node.get('name'), node.text) for node in root.iter('ph'))
|
||||
|
||||
|
||||
def validate_placeholders(source_message, translated_message):
|
||||
"""Validate placeholders before and after conversion to XTB syntax."""
|
||||
errors = []
|
||||
source_root = xml.fromstring(f'<t>{source_message}</t>')
|
||||
translated_root = xml.fromstring(f'<t>{translated_message}</t>')
|
||||
expected = get_placeholders(source_root)
|
||||
|
||||
if get_placeholders(translated_root) != expected:
|
||||
errors.append('translation placeholders do not match source')
|
||||
|
||||
converted_root = xml.fromstring(f'<t>{to_xtb_message(translated_message)}</t>')
|
||||
converted = get_placeholders(converted_root)
|
||||
expected_converted = sorted((name, None) for name, _value in expected)
|
||||
if converted != expected_converted:
|
||||
errors.append('XTB conversion changed placeholders')
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
def main():
|
||||
"""Validate all translation files."""
|
||||
@@ -18,7 +47,7 @@ def main():
|
||||
|
||||
with open(I18N_DIR / 'source.gen.json', encoding='utf-8') as file:
|
||||
source = json.load(file)
|
||||
source_keys = {(s['name'], s['message']) for s in source}
|
||||
source_by_key = {(s['name'], s['message']): s for s in source}
|
||||
|
||||
for path in sorted((I18N_DIR / 'translations').glob('*.json')):
|
||||
with open(path, encoding='utf-8') as file:
|
||||
@@ -35,11 +64,17 @@ def main():
|
||||
continue
|
||||
|
||||
key = (entry['name'], entry['source'])
|
||||
if key not in source_keys:
|
||||
source_entry = source_by_key.get(key)
|
||||
if source_entry is None:
|
||||
print(f'{path.name}[{i}] ({entry["name"]}): '
|
||||
f'no matching source string',
|
||||
file=sys.stderr)
|
||||
errors += 1
|
||||
continue
|
||||
|
||||
for error in validate_placeholders(source_entry['message'], entry['message']):
|
||||
print(f'{path.name}[{i}] ({entry["name"]}): {error}', file=sys.stderr)
|
||||
errors += 1
|
||||
|
||||
if errors:
|
||||
sys.exit(1)
|
||||
|
||||
@@ -2,17 +2,21 @@
|
||||
# You can use, redistribute, and/or modify this source code under
|
||||
# the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
"""
|
||||
Translation of Helium strings using a completions API.
|
||||
Translation of Helium strings using an LLM backend.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
I18N_DIR = Path(__file__).resolve().parent.parent / 'i18n'
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
I18N_DIR = REPO_ROOT / 'i18n'
|
||||
SOURCE_PATH = I18N_DIR / 'source.gen.json'
|
||||
TRANSLATIONS_DIR = I18N_DIR / 'translations'
|
||||
|
||||
@@ -57,6 +61,49 @@ def llm_chat(prompt, data):
|
||||
return body['choices'][0]['message']['content']
|
||||
|
||||
|
||||
def run_command(cmd, data):
|
||||
"""Run a non-interactive CLI backend."""
|
||||
with tempfile.TemporaryDirectory(prefix='helium-i18n-cmd-') as cwd:
|
||||
try:
|
||||
proc = subprocess.run(cmd,
|
||||
input=data,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
check=True,
|
||||
cwd=cwd)
|
||||
except FileNotFoundError as exc:
|
||||
raise RuntimeError(f'{cmd[0]} executable not found') from exc
|
||||
except subprocess.CalledProcessError as exc:
|
||||
details = []
|
||||
if exc.stderr:
|
||||
details.append(exc.stderr.strip())
|
||||
if exc.stdout:
|
||||
details.append(f'stdout:\n{exc.stdout.strip()}')
|
||||
message = f'{cmd[0]} failed'
|
||||
if details:
|
||||
message += ':\n' + '\n'.join(details)
|
||||
raise RuntimeError(message) from exc
|
||||
|
||||
return proc.stdout
|
||||
|
||||
|
||||
def command_chat(prompt, data, command):
|
||||
"""Send a translation request through a provided command."""
|
||||
cmd = shlex.split(command)
|
||||
if not cmd:
|
||||
raise ValueError('--cmd must not be empty')
|
||||
|
||||
cmd.append(prompt)
|
||||
return run_command(cmd, data)
|
||||
|
||||
|
||||
def translate_with_backend(prompt, data, command=None):
|
||||
"""Send a translation request to the selected backend."""
|
||||
if command:
|
||||
return command_chat(prompt, data, command)
|
||||
return llm_chat(prompt, data)
|
||||
|
||||
|
||||
def load_existing(lang_code):
|
||||
"""Load existing translations as a dict keyed by (name, source)."""
|
||||
path = TRANSLATIONS_DIR / f'{lang_code}.json'
|
||||
@@ -247,8 +294,10 @@ def save_translations(lang_code, source, existing, response, dedup_map):
|
||||
file.write('\n')
|
||||
|
||||
|
||||
def translate_language(lang_code, lang_name, source, prompt_template, from_file=None):
|
||||
# pylint: disable-next=too-many-locals
|
||||
def translate_language(language, source, prompt_template, from_file=None, command=None):
|
||||
"""Run translation for a single language."""
|
||||
lang_code, lang_name = language
|
||||
existing = load_existing(lang_code)
|
||||
untranslated = find_untranslated(source, existing)
|
||||
|
||||
@@ -269,7 +318,7 @@ def translate_language(lang_code, lang_name, source, prompt_template, from_file=
|
||||
else:
|
||||
prompt = fill_prompt(prompt_template, lang_name, lang_code)
|
||||
data = json.dumps(payload, ensure_ascii=False)
|
||||
raw = llm_chat(prompt, data)
|
||||
raw = translate_with_backend(prompt, data, command)
|
||||
|
||||
response = parse_response(raw, expected_names)
|
||||
|
||||
@@ -287,15 +336,20 @@ def run(args):
|
||||
prompt_template = (I18N_DIR / 'prompt.md').read_text(encoding='utf-8')
|
||||
TRANSLATIONS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
language = getattr(args, 'language', None)
|
||||
from_file = getattr(args, 'from_file', None)
|
||||
command = getattr(args, 'cmd', None)
|
||||
|
||||
if args.language:
|
||||
for code in args.language:
|
||||
if not command:
|
||||
command = os.environ.get('I18N_TRANSLATE_CMD')
|
||||
|
||||
if language:
|
||||
for code in language:
|
||||
if code not in languages:
|
||||
raise ValueError(f'unknown language code: {code}')
|
||||
translate_language(code, languages[code], source, prompt_template, from_file)
|
||||
translate_language((code, languages[code]), source, prompt_template, from_file, command)
|
||||
else:
|
||||
if from_file:
|
||||
raise ValueError('--from-file requires --language')
|
||||
for code, name in languages.items():
|
||||
translate_language(code, name, source, prompt_template)
|
||||
translate_language((code, name), source, prompt_template, command=command)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ the process has finished.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
|
||||
from itertools import repeat
|
||||
from multiprocessing import Pool
|
||||
from pathlib import Path, PurePosixPath
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'utils'))
|
||||
@@ -70,7 +70,7 @@ PRUNING_EXCLUDE_PATTERNS = [
|
||||
# Exclusion for performance tracing
|
||||
'third_party/perfetto/src/trace_processor/importers/proto/atoms.descriptor',
|
||||
# Exclusion for zoneinfo64
|
||||
'third_party/rust/chromium_crates_io/vendor/zoneinfo64-v0_2/src/data/zoneinfo64.res',
|
||||
'third_party/rust/chromium_crates_io/vendor/zoneinfo64-v0_3/src/data/zoneinfo64.res',
|
||||
# Exclusions for uBlock Origin
|
||||
'third_party/ublock/js/wasm/biditrie.wasm',
|
||||
'third_party/ublock/js/wasm/hntrie.wasm',
|
||||
@@ -338,7 +338,7 @@ def compute_lists(source_tree, search_regex, processes): # pylint: disable=too-m
|
||||
unused_patterns = UnusedPatterns()
|
||||
|
||||
# Launch multiple processes iterating over the source tree
|
||||
with Pool(processes) as procpool:
|
||||
with multiprocessing.Pool(processes) as procpool:
|
||||
returned_data = procpool.starmap(
|
||||
compute_lists_proc,
|
||||
zip(source_tree.rglob('*'), repeat(source_tree), repeat(search_regex)))
|
||||
@@ -427,4 +427,6 @@ def main(args_list=None):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if os.name == 'posix':
|
||||
multiprocessing.set_start_method('fork')
|
||||
main()
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2026 The Helium Authors
|
||||
# You can use, redistribute, and/or modify this source code under
|
||||
# the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
|
||||
# Copyright (c) 2019 The ungoogled-chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE.ungoogled_chromium file.
|
||||
@@ -73,6 +77,7 @@ def _rename_files_with_dirs(root_dir, source_dir, sorted_file_iter):
|
||||
complete_path = Path(root_dir, partial_path)
|
||||
complete_source_path = Path(source_dir, partial_path)
|
||||
try:
|
||||
complete_source_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
complete_path.rename(complete_source_path)
|
||||
except FileNotFoundError:
|
||||
get_logger().warning('Could not move prepended patch: %s', complete_path)
|
||||
@@ -87,6 +92,44 @@ def _rename_files_with_dirs(root_dir, source_dir, sorted_file_iter):
|
||||
complete_path = complete_path.parent
|
||||
|
||||
|
||||
def _series_path(series_line):
|
||||
return series_line.split(' #', maxsplit=1)[0]
|
||||
|
||||
|
||||
def _parse_series_metadata(series_lines):
|
||||
paths = set()
|
||||
# patch path -> list of lines after patch path and before next patch path
|
||||
path_comments = {}
|
||||
# patch path -> inline comment for patch
|
||||
path_inline_comments = {}
|
||||
previous_path = None
|
||||
for partial_path in series_lines:
|
||||
if not partial_path or partial_path.startswith('#'):
|
||||
if previous_path not in path_comments:
|
||||
path_comments[previous_path] = []
|
||||
path_comments[previous_path].append(partial_path)
|
||||
else:
|
||||
previous_path = _series_path(partial_path)
|
||||
paths.add(previous_path)
|
||||
path_parts = partial_path.split(' #', maxsplit=1)
|
||||
if len(path_parts) == 2:
|
||||
path_inline_comments[previous_path] = path_parts[1]
|
||||
return paths, path_comments, path_inline_comments
|
||||
|
||||
|
||||
def _restore_series_metadata(series, path_comments, path_inline_comments):
|
||||
series_index = 0
|
||||
while series_index < len(series):
|
||||
current_path = series[series_index]
|
||||
clean_path = _series_path(current_path)
|
||||
if clean_path in path_inline_comments:
|
||||
series[series_index] = clean_path + ' #' + path_inline_comments[clean_path]
|
||||
if clean_path in path_comments:
|
||||
series.insert(series_index + 1, '\n'.join(path_comments[clean_path]))
|
||||
series_index += 1
|
||||
series_index += 1
|
||||
|
||||
|
||||
def unmerge_platform_patches(platform_patches_dir, prepend_patches_dir):
|
||||
'''
|
||||
Undo merge_platform_patches(), adding any new patches from series.merged as necessary
|
||||
@@ -97,54 +140,48 @@ def unmerge_platform_patches(platform_patches_dir, prepend_patches_dir):
|
||||
get_logger().error('Unable to find series.prepend at: %s',
|
||||
platform_patches_dir / _SERIES_PREPEND)
|
||||
return False
|
||||
prepend_series = set(
|
||||
filter(len,
|
||||
(platform_patches_dir / _SERIES_PREPEND).read_text(encoding=ENCODING).splitlines()))
|
||||
|
||||
# Move prepended files back to original location, preserving changes
|
||||
_rename_files_with_dirs(platform_patches_dir, prepend_patches_dir, sorted(prepend_series))
|
||||
prepend_series, prepend_path_comments, prepend_path_inline_comments = _parse_series_metadata(
|
||||
(platform_patches_dir / _SERIES_PREPEND).read_text(encoding=ENCODING).splitlines())
|
||||
|
||||
# Determine positions of blank spaces in series.orig
|
||||
if not (platform_patches_dir / _SERIES_ORIG).exists():
|
||||
get_logger().error('Unable to find series.orig at: %s', platform_patches_dir / _SERIES_ORIG)
|
||||
return False
|
||||
orig_series = (platform_patches_dir / _SERIES_ORIG).read_text(encoding=ENCODING).splitlines()
|
||||
# patch path -> list of lines after patch path and before next patch path
|
||||
path_comments = {}
|
||||
# patch path -> inline comment for patch
|
||||
path_inline_comments = {}
|
||||
previous_path = None
|
||||
for partial_path in orig_series:
|
||||
if not partial_path or partial_path.startswith('#'):
|
||||
if partial_path not in path_comments:
|
||||
path_comments[previous_path] = []
|
||||
path_comments[previous_path].append(partial_path)
|
||||
else:
|
||||
path_parts = partial_path.split(' #', maxsplit=1)
|
||||
previous_path = path_parts[0]
|
||||
if len(path_parts) == 2:
|
||||
path_inline_comments[path_parts[0]] = path_parts[1]
|
||||
orig_series_paths, path_comments, path_inline_comments = _parse_series_metadata(
|
||||
(platform_patches_dir / _SERIES_ORIG).read_text(encoding=ENCODING).splitlines())
|
||||
|
||||
# Apply changes on series.merged into a modified version of series.orig
|
||||
if not (platform_patches_dir / _SERIES_MERGED).exists():
|
||||
get_logger().error('Unable to find series.merged at: %s',
|
||||
platform_patches_dir / _SERIES_MERGED)
|
||||
return False
|
||||
new_series = filter(len, (platform_patches_dir /
|
||||
_SERIES_MERGED).read_text(encoding=ENCODING).splitlines())
|
||||
new_series = filter((lambda x: x not in prepend_series), new_series)
|
||||
new_series = list(new_series)
|
||||
series_index = 0
|
||||
while series_index < len(new_series):
|
||||
current_path = new_series[series_index]
|
||||
if current_path in path_inline_comments:
|
||||
new_series[series_index] = current_path + ' #' + path_inline_comments[current_path]
|
||||
if current_path in path_comments:
|
||||
new_series.insert(series_index + 1, '\n'.join(path_comments[current_path]))
|
||||
series_index += 1
|
||||
series_index += 1
|
||||
merged_series = filter(len, (platform_patches_dir /
|
||||
_SERIES_MERGED).read_text(encoding=ENCODING).splitlines())
|
||||
generic_series = []
|
||||
new_series = []
|
||||
in_platform_series = False
|
||||
for current_path in merged_series:
|
||||
clean_path = _series_path(current_path)
|
||||
if clean_path in orig_series_paths:
|
||||
in_platform_series = True
|
||||
if clean_path in prepend_series or not in_platform_series:
|
||||
generic_series.append(current_path)
|
||||
else:
|
||||
new_series.append(current_path)
|
||||
|
||||
# Move prepended files back to original location, preserving changes
|
||||
# including any new patches added before the platform patch block.
|
||||
_rename_files_with_dirs(
|
||||
platform_patches_dir, prepend_patches_dir,
|
||||
sorted(prepend_series.union(_series_path(patch_path) for patch_path in generic_series)))
|
||||
|
||||
_restore_series_metadata(generic_series, prepend_path_comments, prepend_path_inline_comments)
|
||||
_restore_series_metadata(new_series, path_comments, path_inline_comments)
|
||||
|
||||
# Write series file
|
||||
with (prepend_patches_dir / _SERIES).open('w', encoding=ENCODING) as series_file:
|
||||
series_file.write('\n'.join(generic_series))
|
||||
series_file.write('\n')
|
||||
with (platform_patches_dir / _SERIES).open('w', encoding=ENCODING) as series_file:
|
||||
series_file.write('\n'.join(new_series))
|
||||
series_file.write('\n')
|
||||
|
||||
@@ -39,7 +39,7 @@ try:
|
||||
import urllib3.util
|
||||
|
||||
class _VerboseRetry(urllib3.util.Retry):
|
||||
"""A more verbose version of HTTP Adatper about retries"""
|
||||
"""A more verbose version of HTTP Adapter about retries"""
|
||||
|
||||
def sleep_for_retry(self, response=None):
|
||||
"""Sleeps for Retry-After, and logs the sleep time"""
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
fonts(\\*?)\.googleapis(\\*?)\.com#f0ntz\g<1>.9oo91e8p1\g<2>.qjz9zk
|
||||
google([A-Za-z\-]*?\\*?)\.com(?!mon)#9oo91e\g<1>.qjz9zk
|
||||
(?<![A-Za-z0-9.*-])(\.?(?!support\.google\.com(?![A-Za-z0-9.-]))(?:[A-Za-z0-9*-]+\.)*[A-Za-z0-9*-]*?)google([A-Za-z\-]*?\\*?)\.com(?!mon)#\g<1>9oo91e\g<2>.qjz9zk
|
||||
gstatic([A-Za-z\-]*?\\*?)\.com#95tat1c\g<1>.qjz9zk
|
||||
chrome([A-Za-z\-]*?\\*?)\.com(?!ponent)#ch40me\g<1>.qjz9zk
|
||||
(?<![A-Za-z0-9.*-])(\.?(?!(?:developer\.chrome\.com|(?:www\.)?chromestatus\.com)(?![A-Za-z0-9.-]))(?:[A-Za-z0-9*-]+\.)*[A-Za-z0-9*-]*?)chrome([A-Za-z\-]*?\\*?)\.com(?!ponent)#\g<1>ch40me\g<2>.qjz9zk
|
||||
chromium(?!app)([A-Za-z\-]*?\\*?)\.org#ch40m1um\g<1>.qjz9zk
|
||||
mozilla([A-Za-z\-]*?\\*?)\.org#m0z111a\g<1>.qjz9zk
|
||||
facebook([A-Za-z\-]*?\\*?)\.com#f8c3b00k\g<1>.qjz9zk
|
||||
|
||||
+1173
-1520
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
build_with_tflite_lib=false
|
||||
chrome_pgo_phase=0
|
||||
clang_use_chrome_plugins=false
|
||||
disable_fieldtrial_testing_config=true
|
||||
|
||||
@@ -9,6 +9,14 @@ This directory contains the translations for Helium browser UI strings.
|
||||
beyond what is already supported in Chromium.
|
||||
- `translations/` - Per-language translation files.
|
||||
|
||||
## Submitting translations
|
||||
**Do not open pull requests with new translations!** We run translations [in
|
||||
batches][pr], if you would like to contribute to the translation of Helium,
|
||||
please wait for the next batch.
|
||||
|
||||
If you are editing existing strings (e.g. you noticed some string(s) that are
|
||||
incorrect), feel free to open a pull request as usual.
|
||||
|
||||
## Translation reviewers
|
||||
Your responsibility as a reviewer is to ensure the translation is the
|
||||
best it can be. When reviewing translations for a specific language, focus on:
|
||||
@@ -52,3 +60,5 @@ not by position. Each entry is an object:
|
||||
|
||||
The `feminine`/`masculine` fields are only present when the
|
||||
translation genuinely differs by grammatical gender.
|
||||
|
||||
[pr]: https://github.com/imputnet/helium/pulls?q=i18n+in%3Atitle+is%3Apr+is%3Aopen
|
||||
|
||||
@@ -9,6 +9,7 @@ owners:
|
||||
bn:
|
||||
bs:
|
||||
ca:
|
||||
- zemiakx
|
||||
cs:
|
||||
cy:
|
||||
da:
|
||||
@@ -16,24 +17,31 @@ owners:
|
||||
el:
|
||||
en-GB:
|
||||
es:
|
||||
- zemiakx
|
||||
es-419:
|
||||
- eduqr
|
||||
et:
|
||||
eu:
|
||||
fa:
|
||||
fi:
|
||||
fil:
|
||||
fr:
|
||||
- Maxokie
|
||||
fr-CA:
|
||||
gl:
|
||||
gu:
|
||||
he:
|
||||
- cheddZy
|
||||
hi:
|
||||
- Shriyash-24
|
||||
hr:
|
||||
hu:
|
||||
- ferivoq
|
||||
hy:
|
||||
id:
|
||||
is:
|
||||
it:
|
||||
- Bellisario
|
||||
ja:
|
||||
ka:
|
||||
kk:
|
||||
@@ -56,6 +64,7 @@ owners:
|
||||
or:
|
||||
pa:
|
||||
pl:
|
||||
- niewiemczego
|
||||
pt-BR:
|
||||
pt-PT:
|
||||
ro:
|
||||
@@ -71,12 +80,16 @@ owners:
|
||||
ta:
|
||||
te:
|
||||
th:
|
||||
- loukhin
|
||||
tr:
|
||||
- erdemoon
|
||||
- frknnay
|
||||
uk:
|
||||
ur:
|
||||
uz:
|
||||
vi:
|
||||
zh-CN:
|
||||
- Xiang-CH
|
||||
zh-HK:
|
||||
zh-TW:
|
||||
zu:
|
||||
|
||||
+34
-5
@@ -4,18 +4,47 @@ You are a professional translator for browser UI strings. Translate all provided
|
||||
|
||||
1. **Placeholders**: preserve all `<ph>...</ph>` tags exactly as they appear. Do not translate, reorder, or modify anything inside a `<ph>` tag.
|
||||
|
||||
2. **Brand names**: "Helium" is a product name. Never translate it. Other product/brand names (e.g. "uBlock Origin") must also be kept as-is.
|
||||
2. **Brand names**: "Helium" is a product name. Never translate it. Other product/brand names (e.g. "uBlock Origin") must also be kept as-is. Translate non-brand feature and layout names when that is natural for the target language.
|
||||
|
||||
3. **Register**: use the standard formal register used in software UI for this language. For example, use "vous" in French, "Sie" in German, "usted" in Spanish. If the language does not distinguish formality levels, use neutral phrasing.
|
||||
3. **Register**: use a polite, natural UI register, not slang and not legalistic. Use the respectful second-person form where the language distinguishes it, such as "vous" in French, "Sie" in German, and "вы" in Russian. If the target locale normally uses an informal UI voice, such as "tú" in Spanish, use that instead. If the language does not distinguish formality levels, use neutral phrasing.
|
||||
|
||||
4. **Brevity**: match the length and tone of the original. Button labels and menu items should be concise. Descriptions can be longer but should not add information that is not in the original.
|
||||
|
||||
5. **Context**: each string has a `context` field describing where it appears in the UI (button label, toggle description, dialog text, etc.). Use this to guide word choice and tone. When context says "In Title Case", apply the equivalent convention for the target language if one exists, otherwise use standard casing.
|
||||
5. **Context and capitalization**: use the `context` field to guide word choice and tone. Preserve meaningful UI capitalization styles such as Title Case, ALL CAPS, and sentence-style labels, using the closest natural convention for the target language.
|
||||
|
||||
6. **Technical terms**: keep technical terms (URL, HTTPS, DNS, etc.) untranslated. Translate common computing terms (e.g. "bookmarks", "tabs", "downloads") using the standard localized terms established by major browsers in this language.
|
||||
6. **Technical terms**: keep technical terms (URL, HTTPS, DNS, etc.) untranslated unless the target language has a well-established browser UI equivalent. Translate common computing terms (e.g. "bookmarks", "tabs", "downloads") using the standard localized terms established by major browsers in this language.
|
||||
|
||||
7. **Keyboard shortcuts**: keep key names (Ctrl, Shift, Tab, etc.) and symbols in their conventional form for the target language and platform. For most languages, these remain in English/Latin script.
|
||||
|
||||
8. **Language-specific orthography**: use the standard written form expected for the target language. For Russian (`ru`), use the letter `ё` where it is normally written and where using `е` would be less correct or ambiguous.
|
||||
|
||||
9. **Intent**: preserve the UI intent and grammatical role. Commands and buttons should read like actions ("Copy", "Open", "Reset"), settings should read like labels or toggles ("Allow automatic updates"), and help text should read like a description. Use the target language's normal command form; for example, Russian UI commands often use perfective verbs such as "Скопировать" rather than "Копировать".
|
||||
|
||||
10. **Browser style**: Helium is a Chromium-based browser. Use terminology and phrasing that match established browser UI translations for the target language, especially Chromium/Chrome-style translations for common browser concepts.
|
||||
|
||||
11. **ICU plural messages**: some messages use ICU MessageFormat plural syntax. For example:
|
||||
|
||||
```text
|
||||
{MINUTES, plural,
|
||||
=1 {minute}
|
||||
other {minutes}}
|
||||
```
|
||||
|
||||
Keep the argument name (`MINUTES`), the keyword `plural`, exact-number selectors such as `=0` or `=1`, plural-category selectors (`zero`, `one`, `two`, `few`, `many`, and `other`), any `offset:n`, `#` characters, and the surrounding braces as syntax. Translate only the human-readable text inside each selector's braces. `#` means “insert the locale-formatted count”; preserve it exactly and do not add it when the source does not contain it.
|
||||
|
||||
Do not assume every language has only English-style singular and plural forms. Keep every exact-number branch from the source (such as `=0` and `=1`), always include `other`, and use exactly the CLDR cardinal plural categories the target language requires — adding any that are missing from the source and removing any source-language categories (such as `one`, `few`, `many`) that the target language does not use. Consult the [Unicode CLDR Language Plural Rules chart](https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html) for the categories used by each language, the counts assigned to each category, and minimal-pair examples. The chart determines which selector applies to a number; choose the actual translated wording from the message's grammatical context. Exact-number selectors match before language categories: `=1` means only the number 1, while a category such as `one` can cover other numbers too. For example, Russian needs the source above translated as:
|
||||
|
||||
```text
|
||||
{MINUTES, plural,
|
||||
=1 {минута}
|
||||
one {минута}
|
||||
few {минуты}
|
||||
many {минут}
|
||||
other {минуты}}
|
||||
```
|
||||
|
||||
Here `=1` handles 1, `one` handles values such as 21 and 31, `few` handles values such as 2–4 and 22–24, and `many` handles values such as 0, 5–20, and 25–30. Use the categories and wording appropriate for `{{language_code}}`; the Russian example illustrates the mechanism, not a pattern to copy into other languages. Preserve the message's intent: if the source omits the number because it is displayed separately in the UI, do not insert it into the translation.
|
||||
|
||||
## Input
|
||||
|
||||
You will receive a JSON array of objects, each with:
|
||||
@@ -29,7 +58,7 @@ Some `name` values appear more than once with different messages (platform or co
|
||||
|
||||
## Output
|
||||
|
||||
Respond with only a JSON array in the same order as the input. Each element should be an object with:
|
||||
Respond with only a JSON array, in input order, containing one object for each entry that needs translation. Each output element should be an object with:
|
||||
- `name`: the original string identifier (unchanged)
|
||||
- `message`: the translated string (default/neutral form)
|
||||
- `feminine`: feminine form of the translation, if the target language has grammatical gender and this string would differ when addressing a female user. Omit this field if it would be identical to `message`.
|
||||
|
||||
+1173
-20
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
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
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
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
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user