Add Czech locale to translation pipeline, fix time units and bucket selection#919
Add Czech locale to translation pipeline, fix time units and bucket selection#919lukyrys wants to merge 14 commits intorybbit-io:masterfrom
Conversation
|
@lukyrys is attempting to deploy a commit to the goldflag's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds Czech locale support across docs and client, bulk-adds time-interval translation keys to many locales, introduces two translation helper scripts, updates extraction and CI workflows to include Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure the |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
client/src/components/BucketSelection.tsx (1)
6-6:⚠️ Potential issue | 🟠 MajorChange
useExtracted()touseTranslations()to align with client/src guidelines.The file is located in
client/src/components/, which requires usinguseTranslations()per the coding guidelines. WhileuseExtracted()is designed for automatic inline message extraction and is intended for docs components, this file should follow the client/src pattern. If the inline message extraction workflow is needed, update the component to useuseTranslations()with key-based message references instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@client/src/components/BucketSelection.tsx` at line 6, Replace useExtracted with useTranslations in the BucketSelection component: update the import from "next-intl" to import { useTranslations } and replace any call sites of useExtracted() with useTranslations(<namespaceOrKey>) (e.g., const t = useTranslations("BucketSelection") or appropriate namespace), then change inline message references to use key-based lookups (t("yourKey")) instead of inline extraction. Ensure the component's message keys are added to the locale JSON under the chosen namespace and remove any extraction-specific usages that only apply to useExtracted.
🧹 Nitpick comments (1)
client/messages/check_translations.py (1)
12-22: Return a failing exit code when issues are found.As written, this validator always exits successfully, so it can’t gate CI even when empty/missing/stale keys are detected.
💡 Suggested fix
files = ['cs.json', 'zh.json', 'ja.json', 'de.json', 'pl.json', 'pt.json', 'it.json', 'fr.json', 'ko.json', 'es.json'] +has_issues = False for fname in files: @@ english = [k for k, v in trans.items() if k in en and v == en[k] and v != ''] + file_has_issues = bool(empty or stale or missing or english) + has_issues = has_issues or file_has_issues @@ print(f' Still English (same as en.json): {english}') print() + +raise SystemExit(1 if has_issues else 0)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@client/messages/check_translations.py` around lines 12 - 22, The script currently only prints findings (variables empty, stale, missing, english for each fname) and never fails CI; modify the validator so that after printing the report for a file (after the print() block that outputs fname and the lists) it checks if any of empty, stale, missing, or english are non-empty and, if so, calls sys.exit(1) (or raises SystemExit(1)) to return a failing exit code; add an import sys at the top if not present and ensure the check runs for the overall run (e.g., track a flag or perform the exit after each file) so the process exits non-zero when issues are found.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@client/messages/check_translations.py`:
- Around line 3-4: The file opens 'en.json' (and the other JSON files around it)
using a relative path which breaks if the process CWD is not client/messages;
change these file opens to use a script-relative path by building the path from
Path(__file__).resolve().parent and joining the filename (e.g.,
Path(__file__).resolve().parent / 'en.json') before calling open() or
json.load(); update both occurrences that currently open 'en.json' and the other
translation file so they use this script-relative Path to avoid CWD-dependent
failures.
In `@client/messages/cs.json`:
- Around line 290-291: Replace the English word "funnel" in the cs.json
translation value for key "mV7XLc" with the Czech term "trychtýř" to match the
locale terminology; update the string for "mV7XLc" so it reads something like
"Vytvořte svůj první trychtýř pro sledování konverzí v uživatelské cestě na
vašem webu." and ensure spacing and punctuation remain consistent with
surrounding entries.
In `@client/messages/ko.json`:
- Around line 1167-1169: The three Korean translation entries for keys "JIOFW/",
"6uQnsi", and "IoiMPE" incorrectly use the Chinese/Japanese character "分";
update their values to use the correct Korean "분" (e.g., "5분", "10분", "15분") so
they match the neighboring correct translation for "Min" and maintain
consistency across the translations.
In `@client/messages/update_translations.py`:
- Around line 65-66: The code in update_translations.py opens JSON files using
relative paths (e.g., the en.json read around the en_content usage and other
reads/writes near lines 72–73 and 90–92), which depends on the current working
directory; change those file operations to build paths relative to the script
location by resolving Path(__file__).parent and joining the filenames (e.g.,
en.json, other JSONs, and any output files) so all open/read/write calls use
that resolved directory (update the code that reads en_content and the
subsequent file opens to use the script-dir-based Path).
- Around line 6-62: The translations dict in
client/messages/update_translations.py omits the new Czech locale; add a
'cs.json' entry to the translations mapping (the same dict that contains
'zh.json','ja.json',etc.) and populate it with the same message keys used
elsewhere (e.g. 'rd5F5r','5/hIKX','BdV5Om','HCYBYT' and, if needed, 'u9xEkD') so
Czech is included in the update target list; ensure the new 'cs.json' block
follows the same structure and key set as the other language entries.
In `@client/src/components/BucketSelection.tsx`:
- Line 117: The computed timeRangeLength (const timeRangeLength =
DateTime.fromISO(time.endDate).diff(DateTime.fromISO(time.startDate),
"days").days) omits the +1 used by the store's setTime for range mode; update
this calculation to match the store by adding 1 when the range mode is active
(e.g., add (time.mode === 'range' ? 1 : 0) to the diff) so BucketSelection's
bucket options align with setTime's logic; look for the timeRangeLength
declaration in BucketSelection.tsx and reference the store's setTime behavior to
ensure parity.
---
Outside diff comments:
In `@client/src/components/BucketSelection.tsx`:
- Line 6: Replace useExtracted with useTranslations in the BucketSelection
component: update the import from "next-intl" to import { useTranslations } and
replace any call sites of useExtracted() with useTranslations(<namespaceOrKey>)
(e.g., const t = useTranslations("BucketSelection") or appropriate namespace),
then change inline message references to use key-based lookups (t("yourKey"))
instead of inline extraction. Ensure the component's message keys are added to
the locale JSON under the chosen namespace and remove any extraction-specific
usages that only apply to useExtracted.
---
Nitpick comments:
In `@client/messages/check_translations.py`:
- Around line 12-22: The script currently only prints findings (variables empty,
stale, missing, english for each fname) and never fails CI; modify the validator
so that after printing the report for a file (after the print() block that
outputs fname and the lists) it checks if any of empty, stale, missing, or
english are non-empty and, if so, calls sys.exit(1) (or raises SystemExit(1)) to
return a failing exit code; add an import sys at the top if not present and
ensure the check runs for the overall run (e.g., track a flag or perform the
exit after each file) so the process exits non-zero when issues are found.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
.github/workflows/translate-docs.yml.github/workflows/translate.ymlclient/messages/check_translations.pyclient/messages/cs.jsonclient/messages/de.jsonclient/messages/en.jsonclient/messages/es.jsonclient/messages/fr.jsonclient/messages/it.jsonclient/messages/ja.jsonclient/messages/ko.jsonclient/messages/pl.jsonclient/messages/pt.jsonclient/messages/update_translations.pyclient/messages/zh.jsonclient/scripts/extract-messages.mjsclient/src/components/BucketSelection.tsxdocs/scripts/extract-messages.mjs
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
client/messages/cs.json (1)
876-900:⚠️ Potential issue | 🟡 MinorSame formality inconsistency continues in onboarding/trial messaging.
Lines 881, 883-884, 899-900 also use formal "vy" forms ("Začněte", "svou") instead of the informal "ty" forms used throughout the file.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@client/messages/cs.json` around lines 876 - 900, Change the formal-second-person phrasing to informal (ty) for the onboarding/trial messages: update the values for keys RpEtgF, FT1lfL and vYmJVk (replace "Začněte" with "Začni" and adjust nearby wording to informal tone) and verify aO7kNa uses the informal verb form as well; keep keys the same but edit their string values so all four entries match the informal "ty" style used elsewhere.
🧹 Nitpick comments (2)
client/messages/update_translations.py (1)
85-91: Reordering currently preserves keys outsideen.json, which can retain locale drift.Lines 89-91 append non-English extra keys back into output. If the intent is strict locale parity, consider warning or failing on extras (or gating this behavior behind a
--strictmode).
Based on learnings: Store i18n message files inmessages/{locale}.jsonwith consistent key structure across all 10 locales.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@client/messages/update_translations.py` around lines 85 - 91, The current reordering loop (using en_key_order, ordered, data) re-appends keys not present in en.json which preserves locale drift; change this to detect extras via extras = set(data) - set(en_key_order) and then, instead of appending them back, either (a) if a new CLI flag/argument like --strict is set (or a strict boolean in the function), raise a clear error (ValueError/SystemExit) listing extras, or (b) when not strict, emit a warning via the existing logger and skip those extra keys so the output strictly follows en_key_order; remove the second for-loop that appends non-English extras and ensure ordered only contains keys in en_key_order (use en_key_order iteration to populate ordered from data).client/messages/check_translations.py (1)
14-16: Consider adding error handling for missing or malformed files.If a translation file is missing or contains invalid JSON, the script will crash with an unhelpful traceback. Wrapping the file load in a try-except would provide clearer diagnostics.
💡 Proposed improvement
for fname in files: - with open(BASE_DIR / fname, encoding='utf-8') as f: - trans = json.load(f) + fpath = BASE_DIR / fname + try: + with open(fpath, encoding='utf-8') as f: + trans = json.load(f) + except FileNotFoundError: + print(f'{fname}: FILE NOT FOUND') + print() + has_issues = True + continue + except json.JSONDecodeError as e: + print(f'{fname}: INVALID JSON - {e}') + print() + has_issues = True + continue🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@client/messages/check_translations.py` around lines 14 - 16, The loop that opens and json.load()s translation files (iterating over files, using BASE_DIR and variable trans) lacks error handling; wrap the open(BASE_DIR / fname, encoding='utf-8') and json.load(f) calls in a try-except that catches FileNotFoundError and json.JSONDecodeError (and optionally OSError), log or print a clear diagnostic including fname and the exception, and either continue to the next file or collect errors to fail later so the script doesn't crash with an unhelpful traceback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@client/messages/cs.json`:
- Around line 842-858: Several new Czech translations use the formal "vy"/"vaší"
form creating inconsistency with the repo's informal "ty" tone; update the keys
uWRAQk ("Vyberte svůj plán"), Yyi9rs ("Nastavte svůj pracovní prostor"), 17v9l0
("Z vaší karty nebude strženo nic…") and any other new strings in this diff to
the informal equivalents (e.g., "Vyber svůj plán", "Nastav svůj pracovní
prostor", "Z tvé karty nebude strženo nic…") so they match existing informal
translations elsewhere (search for other keys like "Vlož tento kód" to confirm
tone).
In `@client/messages/update_translations.py`:
- Around line 81-84: The loop that applies updates (iterating over
updates.items() and assigning into data[key]) currently skips missing keys
silently while later printing "Updated {fname}"; modify the update logic in the
function handling translation file writes so you detect and record missing keys
per locale (e.g., collect missing_keys for each fname/locale when key not in
data), log or print which keys were skipped for each file (use fname and the
updates variable to reference context), avoid marking the file as fully updated
when missing_keys is non-empty, and after processing all locales return a
non-zero exit code (or raise an error) if any missing keys were skipped so the
caller can detect partial updates.
In `@client/src/components/BucketSelection.tsx`:
- Around line 141-145: The Select misses a matching "day" item when
timeRangeLength === 1 because the JSX only renders <SelectItem value="day"> when
timeRangeLength > 1 while setTime/setBucketToUse picks "day" for ranges up to
31; update the render condition so the "day" option appears for a 1-day range
(e.g., change the check from timeRangeLength > 1 to timeRangeLength >= 1 or
timeRangeLength > 0) so the Select's value ({bucket}) always has a corresponding
<SelectItem>, referencing timeRangeLength, <SelectItem value="day">,
setTime/bucketToUse and bucket/Select.
- Around line 15-50: The UI currently decides which bucket options to render
using time.pastMinutesStart alone, but the store chooses buckets based on the
time range (timeDiff = pastMinutesStart - pastMinutesEnd) so the UI can hide the
active "hour" bucket; update the BucketSelection logic to compute timeDiff =
time.pastMinutesStart - (time.pastMinutesEnd ?? 0) and use timeDiff for the
visibility thresholds (use the same thresholds the store uses: treat ranges >120
minutes as eligible for "hour", and keep your existing >=360 and >=1440 checks
for broader options) so the rendered SelectItem options (values
"minute","five_minutes","fifteen_minutes","hour") match the store's bucket
selection.
---
Outside diff comments:
In `@client/messages/cs.json`:
- Around line 876-900: Change the formal-second-person phrasing to informal (ty)
for the onboarding/trial messages: update the values for keys RpEtgF, FT1lfL and
vYmJVk (replace "Začněte" with "Začni" and adjust nearby wording to informal
tone) and verify aO7kNa uses the informal verb form as well; keep keys the same
but edit their string values so all four entries match the informal "ty" style
used elsewhere.
---
Nitpick comments:
In `@client/messages/check_translations.py`:
- Around line 14-16: The loop that opens and json.load()s translation files
(iterating over files, using BASE_DIR and variable trans) lacks error handling;
wrap the open(BASE_DIR / fname, encoding='utf-8') and json.load(f) calls in a
try-except that catches FileNotFoundError and json.JSONDecodeError (and
optionally OSError), log or print a clear diagnostic including fname and the
exception, and either continue to the next file or collect errors to fail later
so the script doesn't crash with an unhelpful traceback.
In `@client/messages/update_translations.py`:
- Around line 85-91: The current reordering loop (using en_key_order, ordered,
data) re-appends keys not present in en.json which preserves locale drift;
change this to detect extras via extras = set(data) - set(en_key_order) and
then, instead of appending them back, either (a) if a new CLI flag/argument like
--strict is set (or a strict boolean in the function), raise a clear error
(ValueError/SystemExit) listing extras, or (b) when not strict, emit a warning
via the existing logger and skip those extra keys so the output strictly follows
en_key_order; remove the second for-loop that appends non-English extras and
ensure ordered only contains keys in en_key_order (use en_key_order iteration to
populate ordered from data).
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
client/messages/check_translations.pyclient/messages/cs.jsonclient/messages/ko.jsonclient/messages/update_translations.pyclient/src/components/BucketSelection.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- client/messages/ko.json
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
client/src/components/BucketSelection.tsx (1)
3-8: Import ordering does not follow guidelines.Per coding guidelines, imports should be organized with external packages first, then internal imports, sorted alphabetically within groups. Current order mixes external and internal imports.
♻️ Suggested import ordering
"use client"; -import { useStore } from "@/lib/store"; -import { SelectItem, Select, SelectContent, SelectTrigger, SelectValue } from "@/components/ui/select"; -import { DateTime } from "luxon"; -import { useExtracted } from "next-intl"; -import { Time } from "./DateSelector/types"; -import { TimerReset } from "lucide-react"; +import { TimerReset } from "lucide-react"; +import { DateTime } from "luxon"; +import { useTranslations } from "next-intl"; + +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import { useStore } from "@/lib/store"; +import { Time } from "./DateSelector/types";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@client/src/components/BucketSelection.tsx` around lines 3 - 8, Reorder the imports so external packages come first (alphabetically) and then internal imports (alphabetically) — locate the import lines referencing TimerReset, DateTime, and useExtracted (from lucide-react, luxon, next-intl) and move them above the internal imports; then sort the internal imports (the lines importing Select/SelectItem/SelectContent/SelectTrigger/SelectValue, useStore, and Time from "./DateSelector/types") alphabetically within that group so the file imports appear in the correct grouped order.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@client/messages/cs.json`:
- Line 290: Replace the formal imperative and formal possessive in message
"mV7XLc" with the informal form to match the rest of the file: change the value
currently starting with "Vytvořte" and "vašem" to the informal imperative and
possessive, e.g. use "Vytvoř svůj první trychtýř pro sledování konverzí v
uživatelské cestě na tvém webu." Update the string identified by "mV7XLc".
- Line 899: The translation for key "GnHuiT" is using the formal imperative
"Začněte zdarma" which is inconsistent with nearby informal CTAs (e.g.,
"Začni"); update the value for "GnHuiT" to the informal form "Začni zdarma" and
scan the cs.json for any other occurrences of "Začněte" to replace them with the
informal variant so all CTAs in this user flow use the same tone.
---
Nitpick comments:
In `@client/src/components/BucketSelection.tsx`:
- Around line 3-8: Reorder the imports so external packages come first
(alphabetically) and then internal imports (alphabetically) — locate the import
lines referencing TimerReset, DateTime, and useExtracted (from lucide-react,
luxon, next-intl) and move them above the internal imports; then sort the
internal imports (the lines importing
Select/SelectItem/SelectContent/SelectTrigger/SelectValue, useStore, and Time
from "./DateSelector/types") alphabetically within that group so the file
imports appear in the correct grouped order.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/src/i18n/routing.ts`:
- Line 4: Update the languages array in the i18n configuration so it matches
routing: open the languages export/constant in docs/src/lib/i18n.ts (the
languages: [...] declaration) and add the missing 'cs' entry to the array so it
becomes ['en','de','fr','zh','es','pl','it','ko','pt','ja','cs'], ensuring the
array ordering/format matches the existing style and exports.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
docs/messages/cs.jsondocs/src/components/LanguageSwitcher.tsxdocs/src/i18n/routing.ts
✅ Files skipped from review due to trivial changes (1)
- docs/messages/cs.json
4fb31b9 to
3b333c0
Compare
3b333c0 to
890bac8
Compare
Summary
cs(Czech) locale to extraction scripts and both translate workflows — was completely missing, so new keys never propagated to CzechBucketSelectionviauseExtracted()and add translations for all 11 languagescheck_translations.pyandupdate_translations.pyhelper scripts with script-relative paths and CI-ready exit codesAdditional fixes from review
分instead of Korean분dayscalculation was missing+ 1that the store uses, causing wrong bucket options on boundary rangesSummary by CodeRabbit
New Features
Chores