Skip to content

Commit 893d345

Browse files
authored
Merge pull request #8499 from sagemathinc/fix-typo-8435
frontend/files/masked files: fix typo in reported in #8435
2 parents 7d359fd + 8c7cf4e commit 893d345

23 files changed

+126
-19
lines changed

src/.claude/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@
1717
"WebFetch(domain:cocalc.com)",
1818
"WebFetch(domain:doc.cocalc.com)",
1919
"WebFetch(domain:docs.anthropic.com)",
20-
"WebFetch(domain:github.com)"
20+
"WebFetch(domain:github.com)",
21+
"Bash(git checkout:*)",
22+
"Bash(git push:*)",
23+
"Bash(NODE_OPTIONS=--max-old-space-size=8192 ../node_modules/.bin/tsc --noEmit)",
24+
"Bash(docker run:*)",
25+
"Bash(../node_modules/.bin/tsc:*)",
26+
"Bash(npm view:*)",
27+
"WebFetch(domain:www.anthropic.com)",
28+
"WebFetch(domain:mistral.ai)",
29+
"Bash(pnpm i18n:*)",
30+
"WebFetch(domain:simplelocalize.io)"
2131
],
2232
"deny": []
2333
}

src/CLAUDE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,40 @@ CoCalc is organized as a monorepo with key packages:
157157
- REFUSE to modify files when the git repository is on the `master` or `main` branch.
158158
- NEVER proactively create documentation files (`*.md`) or README files. Only create documentation files if explicitly requested by the User.
159159

160+
## React-intl / Internationalization (i18n)
161+
162+
CoCalc uses react-intl for internationalization with SimpleLocalize as the translation platform.
163+
164+
### Translation ID Naming Convention
165+
166+
Translation IDs follow a hierarchical pattern: `[directory].[subdir].[filename].[aspect].[label|title|tooltip|...]`
167+
168+
Examples:
169+
- `labels.masked_files` - for common UI labels
170+
- `account.sign-out.button.title` - for account sign-out dialog
171+
- `command.generic.force_build.label` - for command labels
172+
173+
### Translation Workflow
174+
175+
**For new translation keys:**
176+
1. Add the translation to source code (e.g., `packages/frontend/i18n/common.ts`)
177+
2. Run `pnpm i18n:extract` - updates `extracted.json` from source code
178+
3. Run `pnpm i18n:upload` - sends new strings to SimpleLocalize
179+
4. New keys are automatically translated to all languages
180+
5. Run `pnpm i18n:download` - fetches translations
181+
6. Run `pnpm i18n:compile` - compiles translation files
182+
183+
**For editing existing translation keys:**
184+
Same flow as above, but **before 3. i18n:upload**, delete the key. Only new keys are auto-translated. `pnpm i18n:delete [id]`.
185+
186+
### Translation File Structure
187+
188+
- `packages/frontend/i18n/README.md` - more information
189+
- `packages/frontend/i18n/common.ts` - shared translation definitions
190+
- `packages/frontend/i18n/extracted.json` - auto-generated, do not edit manually
191+
- `packages/frontend/i18n/[locale].json` - downloaded translations per language
192+
- `packages/frontend/i18n/[locale].compiled.json` - compiled for runtime use
193+
160194
# Ignore
161195

162196
- Ignore files covered by `.gitignore`
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
# Delete specific translation keys from SimpleLocalize
3+
# Usage: ./delete.sh key1 [key2 key3 ...]
4+
5+
if [ $# -eq 0 ]; then
6+
echo "Usage: $0 key1 [key2 key3 ...]"
7+
echo "Delete one or more translation keys from SimpleLocalize"
8+
echo ""
9+
echo "Example:"
10+
echo " $0 labels.masked_files"
11+
echo " $0 labels.masked_files account.sign-out.button.title"
12+
exit 1
13+
fi
14+
15+
# Check if SIMPLELOCALIZE_KEY is set
16+
if [ -z "${SIMPLELOCALIZE_KEY}" ]; then
17+
echo "Error: SIMPLELOCALIZE_KEY is not set or is empty. Please provide a valid API key." >&2
18+
exit 1
19+
fi
20+
21+
echo "Deleting translation keys from SimpleLocalize..."
22+
23+
# Loop through all provided keys
24+
for key in "$@"; do
25+
echo
26+
echo "Deleting '$key':"
27+
curl \
28+
--location \
29+
--request DELETE "https://api.simplelocalize.io/api/v1/translation-keys?key=$key" \
30+
--header "X-SimpleLocalize-Token: $SIMPLELOCALIZE_KEY"
31+
done
32+
33+
echo
34+
echo
35+
echo "Done! Now you should run:"
36+
echo " pnpm i18n:upload (to re-upload the key with new content)"
37+
echo " pnpm i18n:download (to fetch updated translations)"
38+
echo " pnpm i18n:compile (to compile translation files)"

src/packages/frontend/i18n/bin/upload.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,27 @@ curl -s -X 'POST' 'https://api.simplelocalize.io/api/v2/jobs/auto-translate' \
1919
-H "X-SimpleLocalize-Token: $SIMPLELOCALIZE_KEY" \
2020
-H 'Content-Type: application/json' \
2121
-d '{"options": []}' | jq '.data|length'
22+
23+
echo "Waiting for auto-translation jobs to complete..."
24+
25+
# Wait for all auto-translation jobs to complete
26+
while true; do
27+
sleep 3
28+
29+
# Get all active jobs
30+
jobs_response=$(curl -s -X 'GET' 'https://api.simplelocalize.io/api/v1/jobs' \
31+
-H 'accept: application/json' \
32+
-H "X-SimpleLocalize-Token: $SIMPLELOCALIZE_KEY")
33+
34+
# Count jobs that are not yet completed (state != "SUCCESS")
35+
total_jobs=$(echo "$jobs_response" | jq '.data | length')
36+
success_jobs=$(echo "$jobs_response" | jq '[.data[] | select(.state == "SUCCESS")] | length')
37+
active_jobs=$((total_jobs - success_jobs))
38+
39+
if [ "$active_jobs" -eq 0 ]; then
40+
echo "✓ All auto-translation jobs completed!"
41+
break
42+
else
43+
echo " $active_jobs job(s) still running..."
44+
fi
45+
done

src/packages/frontend/i18n/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ export const labels = defineMessages({
489489
masked_files: {
490490
id: "labels.masked_files",
491491
defaultMessage:
492-
"{masked, select, true {Hide masked files} other {Show masked files}}. Masked files are autogenerated or temporary files, which are not meant to be edited. They are be grayed out.",
492+
"{masked, select, true {Hide masked files} other {Show masked files}}. Masked files are autogenerated or temporary files, which are not meant to be edited. They are grayed out.",
493493
description: "show/hide masked files in a file-explorer in a UI.",
494494
},
495495
folder: {

src/packages/frontend/i18n/trans/ar_EG.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@
946946
"labels.linux_terminal": "لينكس تيرمنال",
947947
"labels.loading": "جار التحميل...",
948948
"labels.log": "تسجيل",
949-
"labels.masked_files": "{masked, select, true {إخفاء الملفات المخفية} other {إظهار الملفات المخفية}}. الملفات المخفية هي ملفات تم إنشاؤها تلقائيًا أو ملفات مؤقتة، ولا يُقصد تحريرها. ستكون باللون الرمادي.",
949+
"labels.masked_files": "{masked, select, true {إخفاء الملفات المقنعة} other {إظهار الملفات المقنعة}}. الملفات المقنعة هي ملفات تم إنشاؤها تلقائيًا أو ملفات مؤقتة، والتي لا يُقصد تعديلها. يتم تظليلها باللون الرمادي.",
950950
"labels.message.plural": "{num, plural, one {رسالة} other {رسائل}}",
951951
"labels.messages": "رسائل",
952952
"labels.messages.all_messages": "جميع الرسائل",

src/packages/frontend/i18n/trans/de_DE.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@
946946
"labels.linux_terminal": "Linux-Terminal",
947947
"labels.loading": "Laden...",
948948
"labels.log": "Protokoll",
949-
"labels.masked_files": "{masked, select, true {Maskierte Dateien verbergen} other {Maskierte Dateien anzeigen}}. Maskierte Dateien sind automatisch generierte oder temporäre Dateien, die nicht bearbeitet werden sollen. Sie werden ausgegraut.",
949+
"labels.masked_files": "{masked, select, true {Maskierte Dateien ausblenden} other {Maskierte Dateien anzeigen}}. Maskierte Dateien sind automatisch generierte oder temporäre Dateien, die nicht bearbeitet werden sollen. Sie sind ausgegraut.",
950950
"labels.message.plural": "{num, plural, one {Nachricht} other {Nachrichten}}",
951951
"labels.messages": "Nachrichten",
952952
"labels.messages.all_messages": "Alle Nachrichten",

src/packages/frontend/i18n/trans/es_ES.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@
946946
"labels.linux_terminal": "Terminal de Linux",
947947
"labels.loading": "Cargando...",
948948
"labels.log": "Registro",
949-
"labels.masked_files": "{masked, select, true {Ocultar archivos enmascarados} other {Mostrar archivos enmascarados}}. Los archivos enmascarados son archivos autogenerados o temporales, que no están destinados a ser editados. Estarán atenuados.",
949+
"labels.masked_files": "{masked, select, true {Ocultar archivos enmascarados} other {Mostrar archivos enmascarados}}. Los archivos enmascarados son archivos autogenerados o temporales, que no están destinados a ser editados. Están atenuados.",
950950
"labels.message.plural": "{num, plural, one {mensaje} other {mensajes}}",
951951
"labels.messages": "Mensajes",
952952
"labels.messages.all_messages": "Todos los mensajes",

src/packages/frontend/i18n/trans/es_PV.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@
946946
"labels.linux_terminal": "Linux Terminala",
947947
"labels.loading": "Kargatzen...",
948948
"labels.log": "Egunkari",
949-
"labels.masked_files": "{masked, select, true {Maskatutako fitxategiak ezkutatu} other {Maskatutako fitxategiak erakutsi}}. Maskatutako fitxategiak automatikoki sortutako edo behin-behineko fitxategiak dira, ez dira editatzeko pentsatuta. Kolore grisarekin agertuko dira.",
949+
"labels.masked_files": "{masked, select, true {Ezkutatu maskaratutako fitxategiak} other {Erakutsi maskaratutako fitxategiak}}. Maskaratutako fitxategiak automatikoki sortutako edo behin-behineko fitxategiak dira, eta ez dira editatzeko pentsatuta. Grisez agertzen dira.",
950950
"labels.message.plural": "{num, plural, one {Mezua} other {Mezuak}}",
951951
"labels.messages": "Mezuak",
952952
"labels.messages.all_messages": "Mezu guztiak",

src/packages/frontend/i18n/trans/he_IL.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@
946946
"labels.linux_terminal": "לינוקס טרמינל",
947947
"labels.loading": "טוען...",
948948
"labels.log": "יומן",
949-
"labels.masked_files": "{masked, select, true {הסתר קבצים מוסתרים} other {הצג קבצים מוסתרים}}. קבצים מוסתרים הם קבצים שנוצרו אוטומטית או קבצים זמניים, שאינם מיועדים לעריכה. הם יהיו באפור.",
949+
"labels.masked_files": "{masked, select, true {הסתר קבצים מוסתרים} other {הצג קבצים מוסתרים}}. קבצים מוסתרים הם קבצים שנוצרים אוטומטית או קבצים זמניים, אשר לא מיועדים לעריכה. הם מוצגים באפור.",
950950
"labels.message.plural": "{num, plural, one {הודעה} other {הודעות}}",
951951
"labels.messages": "הודעות",
952952
"labels.messages.all_messages": "כל ההודעות",

0 commit comments

Comments
 (0)