Skip to content

🐛 Bug: Fix greeting timezone mismatch and add night greeting#8924

Open
MinitJain wants to merge 8 commits intomakeplane:previewfrom
MinitJain:fix/user-greeting-timezone-mismatch
Open

🐛 Bug: Fix greeting timezone mismatch and add night greeting#8924
MinitJain wants to merge 8 commits intomakeplane:previewfrom
MinitJain:fix/user-greeting-timezone-mismatch

Conversation

@MinitJain
Copy link
Copy Markdown

@MinitJain MinitJain commented Apr 21, 2026

Description

The home page greeting component had two bugs:

  1. Timezone mismatch: hour (used to determine greeting text) was computed using the browser's local timezone, while timeString (displayed time) used user.user_timezone from the profile. These two could differ, producing a greeting like "Good morning" while showing 19:38.

  2. Missing night bucket: hour < 12 classified all midnight-to-noon hours as "morning", so users at 1 AM, 2 AM, 3 AM would see "Good morning".

Root cause in one line: the displayed time and greeting logic were reading time from two different clocks.

Fix:

  • All four Intl.DateTimeFormat calls now use timeZone: userTimezone consistently
  • Added timezone validation with try/catch — if user_timezone is an invalid IANA string, falls back to browser local time instead of throwing RangeError and crashing the component
  • Added night threshold (0–4 AM → "Good night")
  • Added night i18n key to all 19 locale files

Greeting thresholds:

Hours Greeting
0–4 Good night
5–11 Good morning
12–17 Good afternoon
18–23 Good evening

Both apps/web/core/components/home/user-greetings.tsx and apps/web/core/components/user/user-greetings.tsx had identical bugs and were fixed identically.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots and Media

Test Scenarios

  • Set profile timezone to UTC, verify greeting text and displayed time both reflect UTC hour
  • Set profile timezone to a valid non-local timezone (e.g. America/New_York while in IST), verify greeting and time both use New York time
  • Set profile timezone to an invalid string, verify component does not crash and falls back to browser local time
  • Log in between 00:00–04:59 in the active timezone, verify "Good night" appears
  • Log in between 05:00–11:59, verify "Good morning"

References

Summary by CodeRabbit

  • New Features

    • Added a "night" greeting for late-night hours and consolidated greeting display into a single localized template that includes first and last name placeholders.
  • Bug Fixes

    • Improved timezone handling with fallback to the browser timezone and consistent 24-hour time formatting.
  • Localization

    • Added "night" and per‑daypart greeting entries across supported languages.

The greeting text and displayed time were computed from different
timezone sources — hour used browser local time while timeString used
user profile timezone — causing mismatched greeting and display.

Also adds a "night" bucket (0–4 AM) so late-night users no longer see
"Good morning", and guards against invalid timezone strings crashing
the component via a try/catch fallback to browser local time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

User greeting components now delegate time/weekday/date formatting and greeting selection to a new useGreeting(user) hook. Multiple locale bundles gain a top-level night key and a greetings object with parameterized templates for time-of-day greetings.

Changes

Cohort / File(s) Summary
User Greeting Components
apps/web/core/components/home/user-greetings.tsx, apps/web/core/components/user/user-greetings.tsx
Remove inline time/Intl logic; consume useGreeting(user) to obtain greeting, timeString, weekDay, date. Render greeting via t(\greetings.${greeting}`, { first_name, last_name })` with name fallbacks.
New Hook
apps/web/core/hooks/use-greeting.ts
Add useGreeting(user: IUser) and TGreeting type. Validates/memoizes user.user_timezone (try/catch + warn), reads currentTime from useCurrentTime(), formats hour, date, weekDay, timeString with Intl.DateTimeFormat (optional timezone), parses hour and maps to `morning
Internationalization Translation Files
packages/i18n/src/locales/...
cs, de, en, es, fr, id, it, ja, ko, pl, pt-BR, ro, ru, sk, tr-TR, ua, vi-VN, zh-CN, zh-TW
Add top-level night key (localized) and add a greetings object containing parameterized templates (keys: morning, afternoon, evening, and in many files night) that interpolate {first_name} and {last_name}.

Sequence Diagram(s)

sequenceDiagram
  participant Component as UserGreetings Component
  participant Hook as useGreeting Hook
  participant Time as useCurrentTime
  participant Intl as Intl.DateTimeFormat
  Component->>Hook: call useGreeting(user)
  Hook->>Time: read currentTime
  Hook->>Hook: validate/memoize user.user_timezone
  Hook->>Intl: format hour, date, weekday, timeString (with timezone)
  Hook->>Hook: parse hour → determine greeting
  Hook-->>Component: return { greeting, timeString, weekDay, date }
  Component->>Component: call t(`greetings.${greeting}`, { first_name, last_name })
  Component-->>User: render localized greeting and time strings
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰
I nudged the clocks and learned each tongue,
A tiny hook and songs now sprung.
Night tiptoed in on silvery feet—
Names tucked warm, the greeting’s sweet.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title mentions fixing a timezone mismatch and adding night greeting, but the subsequent commit and final code state removed the night greeting feature, making the title partially inaccurate. Clarify whether the final commit still includes the night greeting feature. If removed, update the title to reflect the actual implementation, e.g., 'Fix greeting timezone mismatch and refactor to use useGreeting hook'.
Description check ❓ Inconclusive The PR description is comprehensive and follows the template structure, detailing the bugs fixed, the solution approach, greeting thresholds, test scenarios, and references. However, the description does not reflect the subsequent commit that removed the night greeting. Update the description to reflect the final state of the code. If the night greeting was removed per reviewer feedback, update thresholds, test scenarios, and remove references to the night bucket and i18n changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
packages/i18n/src/locales/ru/translations.ts (1)

496-500: ⚠️ Potential issue | 🟡 Minor

Localize the new night greeting for Russian.

Line 500 leaves the Russian locale in English, so users can see Доброго night. If the greeting is built from fragments, this also needs phrase-level handling for the natural Russian form “Доброй ночи”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/ru/translations.ts` around lines 496 - 500, The
Russian locale currently leaves the "night" key untranslated ("night"), causing
outputs like "Доброго night"; update the translations in
packages/i18n/src/locales/ru/translations.ts so the night fragment is translated
(e.g., change night to "ночи") and, if greetings are composed from fragments,
either (a) provide the correct fragment "ночи" and adjust plural/grammatical
assembly so "Доброй ночи" is formed (change the "good" fragment to a
context-aware form for night if needed) or (b) add a dedicated key like
"goodNight": "Доброй ночи" and ensure the greeting builder uses this specific
key when timeOfDay === "night".
packages/i18n/src/locales/de/translations.ts (1)

501-505: ⚠️ Potential issue | 🟠 Major

Translate the new night greeting across 18 non-English locales.

The English placeholder night: "night" was not translated in German or any of the other 17 affected locales (de, es, fr, it, pt-BR, ja, ko, ru, pl, ro, tr-TR, sk, ua, vi-VN, zh-CN, zh-TW, cs, id). Users will see mixed-language greetings across multiple languages. For German specifically, ensure the translation produces grammatically correct phrases like "Gute Nacht" rather than "Guten Nacht" if the UI concatenates time-of-day keys.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/de/translations.ts` around lines 501 - 505, The
German locale currently has incorrect entries for the greeting keys in
translations.ts: change the "good" value from "Guten" to "Gute" and replace the
placeholder "night": "night" with the proper German translation "night": "Nacht"
so concatenation produces "Gute Nacht"; update the same "night" key in the other
17 locale files (es, fr, it, pt-BR, ja, ko, ru, pl, ro, tr-TR, sk, ua, vi-VN,
zh-CN, zh-TW, cs, id) with their correct translations, locating the entries by
the keys good, morning, afternoon, evening, and night in each translations.ts to
make consistent time-of-day greetings.
packages/i18n/src/locales/sk/translations.ts (1)

488-492: ⚠️ Potential issue | 🟡 Minor

Localize the new Slovak night value.

Line 492 leaves the new greeting bucket in English, so Slovak users can see mixed-language greeting text.

🌐 Proposed fix
-  night: "night",
+  night: "noc",

If the UI composes this as good + night, please also verify the final rendered Slovak phrase, since night greetings may need a full-phrase translation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/sk/translations.ts` around lines 488 - 492, The key
"night" in the Slovak translations object is still English ("night"); update the
"night" value to the correct Slovak word (e.g., "noc" or the context-appropriate
phrase) alongside the existing keys (good, morning, afternoon, evening, night)
so all greeting parts are localized; also check where the UI composes greetings
from "good" + "night" (or similar concatenation) and, if needed, replace the
composed parts with a single localized phrase or adjust the "good" and "night"
strings so the final rendered Slovak greeting reads naturally.
packages/i18n/src/locales/fr/translations.ts (1)

497-501: ⚠️ Potential issue | 🟡 Minor

Localize the new French night value.

Line 501 leaves the new greeting bucket in English, so French users can see mixed-language greeting text.

🌐 Proposed fix
-  night: "night",
+  night: "nuit",

If this is rendered as a composed greeting, please verify the full French phrase because “Good night” is usually not a direct good + night construction.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/fr/translations.ts` around lines 497 - 501, The
'night' translation key is still English; update the value for the night key in
the translations object (the same object that contains good, morning, afternoon,
evening) to a proper French string—use "nuit" if the key is used as a noun or
"bonne nuit" if it's rendered as a full greeting (e.g., composed with 'good'
resulting in "bonne nuit"); if your UI composes greetings by concatenating
'good' + ' ' + 'night', prefer setting night="nuit" and change composition to
produce "Bonne nuit" or replace night with "bonne nuit" and remove concatenation
to avoid double words/capitalization issues.
packages/i18n/src/locales/es/translations.ts (1)

501-505: ⚠️ Potential issue | 🟡 Minor

Localize the new Spanish night value.

Line 505 leaves the new greeting bucket in English, so Spanish users can see mixed-language greeting text.

🌐 Proposed fix
-  night: "night",
+  night: "noches",

Please verify the final rendered greeting as well, since Spanish night greetings usually need agreement with the preceding word.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/es/translations.ts` around lines 501 - 505, The
Spanish translations file left the "night" key untranslated; change the "night"
value from "night" to "noches" and then ensure gender/number agreement for the
composed greeting used by the UI: either add a specific key like "good_night":
"Buenas" or extend the existing "good" key to provide gendered variants (e.g.,
good.masc / good.fem) so that when the code composes greetings (using keys good,
morning/afternoon/evening/night) the final rendered phrase is correct (e.g.,
"Buenas noches" instead of "Buenos noches"); update the translations in
translations.ts accordingly and adjust any consuming code to use the new key or
variant.
🧹 Nitpick comments (2)
apps/web/core/components/user/user-greetings.tsx (2)

25-33: Consider useMemo for the timezone validation IIFE.

The IIFE runs on every render (and currentTime updates frequently via useCurrentTime), constructing a throwaway Intl.DateTimeFormat each time just for validation. Wrapping it in useMemo keyed on user?.user_timezone avoids redundant work and lets the validated value be reused.

♻️ Proposed refactor
-  const userTimezone = (() => {
-    if (!user?.user_timezone) return undefined;
-    try {
-      Intl.DateTimeFormat(undefined, { timeZone: user.user_timezone });
-      return user.user_timezone;
-    } catch {
-      return undefined;
-    }
-  })();
+  const userTimezone = useMemo(() => {
+    if (!user?.user_timezone) return undefined;
+    try {
+      new Intl.DateTimeFormat(undefined, { timeZone: user.user_timezone });
+      return user.user_timezone;
+    } catch {
+      return undefined;
+    }
+  }, [user?.user_timezone]);

Note: Intl.DateTimeFormat(...) without new still works for validation, but adding new is the conventional form.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/core/components/user/user-greetings.tsx` around lines 25 - 33,
Refactor the userTimezone IIFE into a memoized computation using React's useMemo
so validation only runs when user?.user_timezone changes: replace the
self-invoking function that constructs Intl.DateTimeFormat with a useMemo hook
keyed on user?.user_timezone, keep the same try/catch validation logic (use new
Intl.DateTimeFormat for clarity) and return undefined on invalid values; ensure
the variable name userTimezone remains the same so existing consumers are
unchanged and avoid tying it to currentTime or other frequently-updating state
like useCurrentTime.

1-75: Remove the unused duplicate — apps/web/core/components/user/user-greetings.tsx is dead code.

Both apps/web/core/components/user/user-greetings.tsx and apps/web/core/components/home/user-greetings.tsx are byte-for-byte identical in implementation. The user version is exported via user/index.ts but has zero consumers in the codebase, while the home version is actively used in apps/web/core/components/home/root.tsx. Delete the user version and update the barrel export, or consolidate into a shared component if the barrel export path is intended for future use.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/core/components/user/user-greetings.tsx` around lines 1 - 75, The
file defines a duplicate component UserGreetingsView that is unused; remove this
dead copy and update exports: delete the duplicate UserGreetingsView
implementation (the unused user variant) and remove its export from the user
barrel (user/index.ts) or point that barrel to the existing home variant (the
single shared UserGreetingsView used by home/root.tsx); alternatively
consolidate by exporting the shared component from one location and updating any
imports to reference that single export so only one implementation remains.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/core/components/user/user-greetings.tsx`:
- Around line 35-60: The midnight hour formats as "24" causing hourNum to be 24
and the greeting to misclassify as "evening"; update the two Intl.DateTimeFormat
instances that produce hour and timeString to include hourCycle: "h23" so
midnight formats as "0" and the hourNum/greeting logic (variables hour,
timeString, hourNum, greeting) works correctly; make the identical change in the
other user-greetings.tsx component that contains the same hour/timeString
formatters.

In `@packages/i18n/src/locales/cs/translations.ts`:
- Line 492: The Czech locale currently has the key "night" set to the English
string "night"; update the value of the "night" translation in
packages/i18n/src/locales/cs/translations.ts (the "night" entry) to the approved
Czech wording so the late-night greeting renders fully localized.

In `@packages/i18n/src/locales/id/translations.ts`:
- Line 497: The translations file contains an untranslated "night" key (e.g., in
packages/i18n/src/locales/id/translations.ts the entry night: "night") — replace
the English literal with the appropriate Indonesian string ("dini hari") and
ensure the semantic bucket for 00:00–04:59 is correct (note evening already maps
to "malam"); repeat the same fix across the other non-English locale files
listed (zh-CN, vi-VN, zh-TW, tr-TR, sk, ro, ua, pt-BR, it, ja, fr, es, ko, ru,
de, cs, pl) by replacing their "night" values with the correct localized
translations for the 00:00–04:59 time range while keeping the key name night
unchanged.

In `@packages/i18n/src/locales/it/translations.ts`:
- Line 498: The Italian translations file contains the key "night" set to the
English string "night"; update the Italian locale's translations.ts entry for
the "night" key to the proper Italian text (e.g., "notte" or "buonanotte") so
the night greeting is localized; locate the "night" key in the translations
object and replace the English value with the chosen Italian translation.

In `@packages/i18n/src/locales/ja/translations.ts`:
- Line 491: The `night` translation is still in English; update the value for
the `night` key in the translations object (symbol: night in translations.ts) to
a proper Japanese string such as "夜" or "おやすみなさい" so it matches the other
localized time-of-day keys; simply replace "night": "night" with "night": "夜"
(or your preferred Japanese phrasing).

In `@packages/i18n/src/locales/ko/translations.ts`:
- Line 485: The translations object contains an English value for the key night
(night: "night") in packages/i18n/src/locales/ko/translations.ts; replace the
English string with the correct Korean localization (e.g., "밤" or the preferred
Korean greeting) so the Korean UI displays a native time-of-day label for the
night key.

In `@packages/i18n/src/locales/pl/translations.ts`:
- Line 491: The Polish locale has the 'night' translation left in English
("night"); update the value for the 'night' key in translations.ts to the
correct Polish string (e.g., "noc" or a suitable greeting) so it matches the
other time-of-day keys like 'morning', 'afternoon', and 'evening' in that file;
locate the 'night' key in the translations.ts dictionary and replace its value
with the Polish translation.

In `@packages/i18n/src/locales/pt-BR/translations.ts`:
- Line 501: The pt-BR translations object currently has night: "night"
(English); update the pt-BR locale entry for the key "night" in
packages/i18n/src/locales/pt-BR/translations.ts to the Brazilian Portuguese term
("noite") so the greeting is properly localized, making sure you modify the
exported translations object (the "night" property) rather than adding a new
key.

In `@packages/i18n/src/locales/ro/translations.ts`:
- Line 498: The translations file currently uses the English string "night" for
the key named night in packages/i18n/src/locales/ro/translations.ts; replace
that placeholder with the proper Romanian translation (e.g., "noapte") for the
night key and ensure the change is saved in the translations.ts export so the
locale bundle contains the correct string; after updating, run the i18n/locales
smoke tests or build step you use to validate translation keys so compilation
and consumers pick up the corrected Romanian value (also review the same night
key in the other locale translation files you own and update them similarly if
they still contain the English placeholder).

In `@packages/i18n/src/locales/tr-TR/translations.ts`:
- Line 493: The Turkish translations object currently has the key 'night' set to
the English string "night"; update the 'night' entry in the translations object
to the correct Turkish greeting (e.g., "iyi geceler") and ensure the value
follows the same quoting/casing style as the surrounding entries so the locale
no longer contains an English fragment.

In `@packages/i18n/src/locales/ua/translations.ts`:
- Line 500: Replace the English placeholder for the translation key 'night' in
translations.ts with the correct Ukrainian word "ночі" so the composed greeting
(e.g., "Доброї ночі") is grammatically correct; update the value for the 'night'
key in the exported translations object accordingly and run a quick UI check for
strings that concatenate with this key to ensure correct case/declension.

In `@packages/i18n/src/locales/vi-VN/translations.ts`:
- Line 498: Replace the English fallback for the translations key "night" in the
translations object with the approved Vietnamese wording; update the entry
night: "night" to night: "đêm" so the vi-VN locale shows the proper Vietnamese
label for the 00:00–04:59 greeting bucket.

In `@packages/i18n/src/locales/zh-CN/translations.ts`:
- Line 480: Replace the English placeholder value for the translations key
"night" in the zh-CN locale by changing night: "night" to night: "晚安" in
packages/i18n/src/locales/zh-CN/translations.ts; then audit the other
non-English locale files (it, zh-TW, tr-TR, ua, vi-VN, sk, pt-BR, ru, pl, ko,
ro, ja, id, es, fr, de, cs) and replace their night: "night" entries with
appropriate localized strings for each language so all non-English locales have
translated text for the "night" label.

In `@packages/i18n/src/locales/zh-TW/translations.ts`:
- Line 479: Replace the English literal for the greeting key night in
translations.ts with a Traditional Chinese string; update the entry night:
"night" to use the zh-TW translation (e.g. night: "深夜好") so that t(greeting)
shows a localized greeting for the 00:00–04:59 bucket.

---

Outside diff comments:
In `@packages/i18n/src/locales/de/translations.ts`:
- Around line 501-505: The German locale currently has incorrect entries for the
greeting keys in translations.ts: change the "good" value from "Guten" to "Gute"
and replace the placeholder "night": "night" with the proper German translation
"night": "Nacht" so concatenation produces "Gute Nacht"; update the same "night"
key in the other 17 locale files (es, fr, it, pt-BR, ja, ko, ru, pl, ro, tr-TR,
sk, ua, vi-VN, zh-CN, zh-TW, cs, id) with their correct translations, locating
the entries by the keys good, morning, afternoon, evening, and night in each
translations.ts to make consistent time-of-day greetings.

In `@packages/i18n/src/locales/es/translations.ts`:
- Around line 501-505: The Spanish translations file left the "night" key
untranslated; change the "night" value from "night" to "noches" and then ensure
gender/number agreement for the composed greeting used by the UI: either add a
specific key like "good_night": "Buenas" or extend the existing "good" key to
provide gendered variants (e.g., good.masc / good.fem) so that when the code
composes greetings (using keys good, morning/afternoon/evening/night) the final
rendered phrase is correct (e.g., "Buenas noches" instead of "Buenos noches");
update the translations in translations.ts accordingly and adjust any consuming
code to use the new key or variant.

In `@packages/i18n/src/locales/fr/translations.ts`:
- Around line 497-501: The 'night' translation key is still English; update the
value for the night key in the translations object (the same object that
contains good, morning, afternoon, evening) to a proper French string—use "nuit"
if the key is used as a noun or "bonne nuit" if it's rendered as a full greeting
(e.g., composed with 'good' resulting in "bonne nuit"); if your UI composes
greetings by concatenating 'good' + ' ' + 'night', prefer setting night="nuit"
and change composition to produce "Bonne nuit" or replace night with "bonne
nuit" and remove concatenation to avoid double words/capitalization issues.

In `@packages/i18n/src/locales/ru/translations.ts`:
- Around line 496-500: The Russian locale currently leaves the "night" key
untranslated ("night"), causing outputs like "Доброго night"; update the
translations in packages/i18n/src/locales/ru/translations.ts so the night
fragment is translated (e.g., change night to "ночи") and, if greetings are
composed from fragments, either (a) provide the correct fragment "ночи" and
adjust plural/grammatical assembly so "Доброй ночи" is formed (change the "good"
fragment to a context-aware form for night if needed) or (b) add a dedicated key
like "goodNight": "Доброй ночи" and ensure the greeting builder uses this
specific key when timeOfDay === "night".

In `@packages/i18n/src/locales/sk/translations.ts`:
- Around line 488-492: The key "night" in the Slovak translations object is
still English ("night"); update the "night" value to the correct Slovak word
(e.g., "noc" or the context-appropriate phrase) alongside the existing keys
(good, morning, afternoon, evening, night) so all greeting parts are localized;
also check where the UI composes greetings from "good" + "night" (or similar
concatenation) and, if needed, replace the composed parts with a single
localized phrase or adjust the "good" and "night" strings so the final rendered
Slovak greeting reads naturally.

---

Nitpick comments:
In `@apps/web/core/components/user/user-greetings.tsx`:
- Around line 25-33: Refactor the userTimezone IIFE into a memoized computation
using React's useMemo so validation only runs when user?.user_timezone changes:
replace the self-invoking function that constructs Intl.DateTimeFormat with a
useMemo hook keyed on user?.user_timezone, keep the same try/catch validation
logic (use new Intl.DateTimeFormat for clarity) and return undefined on invalid
values; ensure the variable name userTimezone remains the same so existing
consumers are unchanged and avoid tying it to currentTime or other
frequently-updating state like useCurrentTime.
- Around line 1-75: The file defines a duplicate component UserGreetingsView
that is unused; remove this dead copy and update exports: delete the duplicate
UserGreetingsView implementation (the unused user variant) and remove its export
from the user barrel (user/index.ts) or point that barrel to the existing home
variant (the single shared UserGreetingsView used by home/root.tsx);
alternatively consolidate by exporting the shared component from one location
and updating any imports to reference that single export so only one
implementation remains.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62eb9433-0f04-4b53-89e9-f3c0fa466e3a

📥 Commits

Reviewing files that changed from the base of the PR and between c62930e and e3b3a77.

📒 Files selected for processing (21)
  • apps/web/core/components/home/user-greetings.tsx
  • apps/web/core/components/user/user-greetings.tsx
  • packages/i18n/src/locales/cs/translations.ts
  • packages/i18n/src/locales/de/translations.ts
  • packages/i18n/src/locales/en/translations.ts
  • packages/i18n/src/locales/es/translations.ts
  • packages/i18n/src/locales/fr/translations.ts
  • packages/i18n/src/locales/id/translations.ts
  • packages/i18n/src/locales/it/translations.ts
  • packages/i18n/src/locales/ja/translations.ts
  • packages/i18n/src/locales/ko/translations.ts
  • packages/i18n/src/locales/pl/translations.ts
  • packages/i18n/src/locales/pt-BR/translations.ts
  • packages/i18n/src/locales/ro/translations.ts
  • packages/i18n/src/locales/ru/translations.ts
  • packages/i18n/src/locales/sk/translations.ts
  • packages/i18n/src/locales/tr-TR/translations.ts
  • packages/i18n/src/locales/ua/translations.ts
  • packages/i18n/src/locales/vi-VN/translations.ts
  • packages/i18n/src/locales/zh-CN/translations.ts
  • packages/i18n/src/locales/zh-TW/translations.ts

Comment thread apps/web/core/components/user/user-greetings.tsx Outdated
Comment thread packages/i18n/src/locales/cs/translations.ts Outdated
morning: "pagi",
afternoon: "siang",
evening: "malam",
night: "night",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find all locale translation files and show the `night` key value to spot any that still carry the English literal or are otherwise untranslated.
fd -e ts 'translations\.ts$' packages/i18n/src/locales --exec sh -c 'printf "%s: " "$1"; rg -N "^\s*night:\s*" "$1" || echo "(missing)"' _ {}

Repository: makeplane/plane

Length of output: 1289


Untranslated night value in Indonesian and all 18 other non-English locales.

All non-English locale files carry the English literal "night" instead of translations. This is a systematic i18n defect affecting 18 locale files (id, zh-CN, vi-VN, zh-TW, tr-TR, sk, ro, ua, pt-BR, it, ja, fr, es, ko, ru, de, cs, pl).

For Indonesian (id), since the evening bucket already maps to "malam" and hours 0–4 require translation, "dini hari" (early morning hours) is semantically appropriate:

Suggested fix for Indonesian
-  night: "night",
+  night: "dini hari",

All 18 non-English locales require equivalent translations for the night key corresponding to the 00:00–04:59 time range.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
night: "night",
night: "dini hari",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/id/translations.ts` at line 497, The translations
file contains an untranslated "night" key (e.g., in
packages/i18n/src/locales/id/translations.ts the entry night: "night") — replace
the English literal with the appropriate Indonesian string ("dini hari") and
ensure the semantic bucket for 00:00–04:59 is correct (note evening already maps
to "malam"); repeat the same fix across the other non-English locale files
listed (zh-CN, vi-VN, zh-TW, tr-TR, sk, ro, ua, pt-BR, it, ja, fr, es, ko, ru,
de, cs, pl) by replacing their "night" values with the correct localized
translations for the 00:00–04:59 time range while keeping the key name night
unchanged.

Comment thread packages/i18n/src/locales/it/translations.ts Outdated
Comment thread packages/i18n/src/locales/ja/translations.ts Outdated
morning: "sabah",
afternoon: "öğleden sonra",
evening: "akşam",
night: "night",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Localize the new Turkish night greeting.

This leaves the Turkish locale with an English greeting fragment.

🌐 Proposed localization fix
-  night: "night",
+  night: "gece",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
night: "night",
night: "gece",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/tr-TR/translations.ts` at line 493, The Turkish
translations object currently has the key 'night' set to the English string
"night"; update the 'night' entry in the translations object to the correct
Turkish greeting (e.g., "iyi geceler") and ensure the value follows the same
quoting/casing style as the surrounding entries so the locale no longer contains
an English fragment.

Comment thread packages/i18n/src/locales/ua/translations.ts Outdated
morning: "Buổi sáng",
afternoon: "Buổi chiều",
evening: "Buổi tối",
night: "night",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Localize the new night label.

The vi-VN locale should not fall back to the English word night for the new 00:00–04:59 greeting bucket. Please use the approved Vietnamese wording.

🌐 Example fix
-  night: "night",
+  night: "Buổi đêm",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
night: "night",
night: "Buổi đêm",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/vi-VN/translations.ts` at line 498, Replace the
English fallback for the translations key "night" in the translations object
with the approved Vietnamese wording; update the entry night: "night" to night:
"đêm" so the vi-VN locale shows the proper Vietnamese label for the 00:00–04:59
greeting bucket.

morning: "早上",
afternoon: "下午",
evening: "晚上",
night: "night",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Find locale files where the new night greeting still uses the English placeholder.
# Expected: Only English locale files, if any, should contain night: "night".

rg -n --glob 'translations.ts' 'night:\s*"night"' packages/i18n/src/locales

Repository: makeplane/plane

Length of output: 1346


Localize the new night label and address this across all non-English locales.

The Chinese locale (and 17 other non-English locale files) still use the English placeholder "night" instead of localized text. For zh-CN, replace it with "晚安" (or another approved Chinese term). Verify that all non-English locale files have proper translations:

  • it, zh-TW, zh-CN, tr-TR, ua, vi-VN, sk, pt-BR, ru, pl, ko, ro, ja, id, es, fr, de, cs (all currently contain night: "night")
Example fix for zh-CN
-  night: "night",
+  night: "晚安",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
night: "night",
night: "晚安",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/zh-CN/translations.ts` at line 480, Replace the
English placeholder value for the translations key "night" in the zh-CN locale
by changing night: "night" to night: "晚安" in
packages/i18n/src/locales/zh-CN/translations.ts; then audit the other
non-English locale files (it, zh-TW, tr-TR, ua, vi-VN, sk, pt-BR, ru, pl, ko,
ro, ja, id, es, fr, de, cs) and replace their night: "night" entries with
appropriate localized strings for each language so all non-English locales have
translated text for the "night" label.

Comment thread packages/i18n/src/locales/zh-TW/translations.ts Outdated
… translations

Replace hour12: false with hourCycle: "h23" on hour and timeString formatters
so midnight returns "0" instead of "24" in Chromium-based browsers (h24 cycle).
This prevented the night greeting from firing at 00:00.

Also adds proper localized translations for the night key across all 18
non-English locales instead of the English placeholder.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/core/components/home/user-greetings.tsx`:
- Around line 60-65: The current composition {t("good")} {t(greeting)} produces
wrong phrase-level translations for the new "night" bucket; change to use a
single phrase-level translation key per bucket (e.g., derive greetingKey =
`greetings.${greeting}` from the existing greeting variable) and replace the JSX
to call t(greetingKey, { first_name: user?.first_name, last_name:
user?.last_name }) or otherwise pass the name into the locale template; update
the locale files to add greetings.night (and ensure morning/afternoon/evening
keys exist) so translations render correctly for {t(greetingKey)} instead of
composing two separate t() calls.
- Around line 25-33: Replace the current IIFE that computes userTimezone with a
memoized computation keyed on user.user_timezone (e.g., useMemo(() => { ... },
[user?.user_timezone])) so validation doesn’t run on every render; inside the
memo, attempt Intl.DateTimeFormat(undefined, { timeZone: user.user_timezone })
inside a try-catch that captures the error as unknown, narrow it to Error (or
stringify) and log a single diagnostic (e.g., console.warn or project logger)
including the invalid timezone and the error message, then return undefined on
failure; reference the symbol userTimezone and the property user.user_timezone
when making these changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0a72437-f268-4d9f-90fa-f7ec13ae7dd2

📥 Commits

Reviewing files that changed from the base of the PR and between e3b3a77 and df7aea7.

📒 Files selected for processing (20)
  • apps/web/core/components/home/user-greetings.tsx
  • apps/web/core/components/user/user-greetings.tsx
  • packages/i18n/src/locales/cs/translations.ts
  • packages/i18n/src/locales/de/translations.ts
  • packages/i18n/src/locales/es/translations.ts
  • packages/i18n/src/locales/fr/translations.ts
  • packages/i18n/src/locales/id/translations.ts
  • packages/i18n/src/locales/it/translations.ts
  • packages/i18n/src/locales/ja/translations.ts
  • packages/i18n/src/locales/ko/translations.ts
  • packages/i18n/src/locales/pl/translations.ts
  • packages/i18n/src/locales/pt-BR/translations.ts
  • packages/i18n/src/locales/ro/translations.ts
  • packages/i18n/src/locales/ru/translations.ts
  • packages/i18n/src/locales/sk/translations.ts
  • packages/i18n/src/locales/tr-TR/translations.ts
  • packages/i18n/src/locales/ua/translations.ts
  • packages/i18n/src/locales/vi-VN/translations.ts
  • packages/i18n/src/locales/zh-CN/translations.ts
  • packages/i18n/src/locales/zh-TW/translations.ts
✅ Files skipped from review due to trivial changes (8)
  • packages/i18n/src/locales/de/translations.ts
  • packages/i18n/src/locales/es/translations.ts
  • packages/i18n/src/locales/tr-TR/translations.ts
  • packages/i18n/src/locales/ja/translations.ts
  • packages/i18n/src/locales/ua/translations.ts
  • packages/i18n/src/locales/pl/translations.ts
  • packages/i18n/src/locales/fr/translations.ts
  • packages/i18n/src/locales/vi-VN/translations.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • packages/i18n/src/locales/zh-CN/translations.ts
  • apps/web/core/components/user/user-greetings.tsx
  • packages/i18n/src/locales/zh-TW/translations.ts
  • packages/i18n/src/locales/pt-BR/translations.ts
  • packages/i18n/src/locales/sk/translations.ts
  • packages/i18n/src/locales/ko/translations.ts
  • packages/i18n/src/locales/ru/translations.ts
  • packages/i18n/src/locales/ro/translations.ts

Comment thread apps/web/core/components/home/user-greetings.tsx Outdated
Comment thread apps/web/core/components/home/user-greetings.tsx Outdated
Replaced IIFE with useMemo keyed on user_timezone so the validation
runs once per timezone change rather than on every render tick.
Also adds console.warn when an invalid timezone is detected so it
is diagnosable rather than silently discarded.
Fixed missing `new` keyword on Intl.DateTimeFormat validation call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
apps/web/core/components/home/user-greetings.tsx (1)

67-67: ⚠️ Potential issue | 🟡 Minor

Same i18n composition issue as in core/components/user/user-greetings.tsx.

{t("good")} {t(greeting)} with the new night key yields incorrect phrases in multiple locales (Czech Dobrý noc, Italian Buono notte, Indonesian Bagus dini hari, etc.) because the noun doesn't agree with the generic good adjective form chosen for morning/afternoon/evening. Switch to one phrase-level translation key per bucket (e.g., greetings.night) and render t(\greetings.${greeting}`)` so locales can provide natural full greetings.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/core/components/home/user-greetings.tsx` at line 67, The current
composition "{t('good')} {t(greeting)}" in the UserGreetings component produces
ungrammatical translations; replace the two-part call with a single phrase-level
key lookup so locales can supply full greetings: change the render to call
t(`greetings.${greeting}`) instead of t("good") and t(greeting), update the i18n
resource keys (add greetings.morning, greetings.afternoon, greetings.evening,
greetings.night as needed) and ensure the component (user-greetings.tsx / the
UserGreetings render) passes the bucket identifier in `greeting` unchanged so
t(`greetings.${greeting}`) resolves correctly.
apps/web/core/components/user/user-greetings.tsx (1)

67-67: ⚠️ Potential issue | 🟡 Minor

Composed {t("good")} {t("night")} still produces grammatically incorrect greetings in several locales.

The hourCycle: "h23" fix and memoized timezone validation look good, but the two-token composition remains problematic for the new night bucket: e.g. Czech Dobrý noc (should be Dobrou noc), Italian Buono notte (should be Buona notte), Indonesian Bagus dini hari. The existing morning/afternoon/evening translations were chosen to fit the good <x> template, but night doesn't agree in gender/case across many locales.

Prefer a single phrase-level key per bucket (e.g., greetings.morninggreetings.night) and render t(\greetings.${greeting}`)` so each locale can provide a natural full phrase.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/core/components/user/user-greetings.tsx` at line 67, The composed
two-token translation using t("good") + t(greeting) produces ungrammatical
phrases in some locales; update the rendering in user-greetings.tsx to use a
single phrase-level key instead (replace the current {t("good")} {t(greeting)}
usage with t(`greetings.${greeting}`) where greeting is the computed bucket),
and ensure all locale files provide greetings.morning / greetings.afternoon /
greetings.evening / greetings.night entries (with sensible fallbacks if a key is
missing) so each locale can supply a grammatically correct full phrase.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@apps/web/core/components/home/user-greetings.tsx`:
- Line 67: The current composition "{t('good')} {t(greeting)}" in the
UserGreetings component produces ungrammatical translations; replace the
two-part call with a single phrase-level key lookup so locales can supply full
greetings: change the render to call t(`greetings.${greeting}`) instead of
t("good") and t(greeting), update the i18n resource keys (add greetings.morning,
greetings.afternoon, greetings.evening, greetings.night as needed) and ensure
the component (user-greetings.tsx / the UserGreetings render) passes the bucket
identifier in `greeting` unchanged so t(`greetings.${greeting}`) resolves
correctly.

In `@apps/web/core/components/user/user-greetings.tsx`:
- Line 67: The composed two-token translation using t("good") + t(greeting)
produces ungrammatical phrases in some locales; update the rendering in
user-greetings.tsx to use a single phrase-level key instead (replace the current
{t("good")} {t(greeting)} usage with t(`greetings.${greeting}`) where greeting
is the computed bucket), and ensure all locale files provide greetings.morning /
greetings.afternoon / greetings.evening / greetings.night entries (with sensible
fallbacks if a key is missing) so each locale can supply a grammatically correct
full phrase.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 46498e70-fecd-4bdc-9289-bff316b49de4

📥 Commits

Reviewing files that changed from the base of the PR and between df7aea7 and 388502a.

📒 Files selected for processing (2)
  • apps/web/core/components/home/user-greetings.tsx
  • apps/web/core/components/user/user-greetings.tsx

Replaces {t("good")} {t(greeting)}, {name} composition with a single
t("greetings.<bucket>", { first_name, last_name }) call. Fragment
composition was grammatically incorrect in many locales — e.g. Russian
"Доброго ночи" instead of "Доброй ночи", German "Guten Nacht" instead
of "Gute Nacht", Czech "Dobrý noc" instead of "Dobrou noc".

Adds greetings.{morning,afternoon,evening,night} nested keys with
proper full-phrase translations across all 19 locale files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/web/core/components/home/user-greetings.tsx (1)

26-62: Consider extracting the shared greeting/timezone derivation.

This timezone validation, Intl.DateTimeFormat setup, and daypart bucketing is duplicated in apps/web/core/components/user/user-greetings.tsx. A small shared hook/helper would reduce future drift—the PR already had to fix this bug twice.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/core/components/home/user-greetings.tsx` around lines 26 - 62,
Extract the duplicated timezone validation, DateTimeFormat setup and greeting
bucketing into a shared hook (e.g., useUserLocalTime) and replace the inline
logic in both UserGreetings components: move the userTimezone useMemo logic (the
Intl.DateTimeFormat validation using user?.user_timezone), the DateTimeFormat
calls that produce hour, date, weekDay, timeString, and the greeting calculation
(parseInt(hour, 10) -> greeting) into that hook; have the hook accept (user,
currentTime) and return {userTimezone, timeString, date, weekDay, hourNum,
greeting}, update both components to call useUserLocalTime(...) and use the
returned values, and ensure the hook preserves the same fallback behavior and
error logging when user_timezone is invalid.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/web/core/components/home/user-greetings.tsx`:
- Around line 26-62: Extract the duplicated timezone validation, DateTimeFormat
setup and greeting bucketing into a shared hook (e.g., useUserLocalTime) and
replace the inline logic in both UserGreetings components: move the userTimezone
useMemo logic (the Intl.DateTimeFormat validation using user?.user_timezone),
the DateTimeFormat calls that produce hour, date, weekDay, timeString, and the
greeting calculation (parseInt(hour, 10) -> greeting) into that hook; have the
hook accept (user, currentTime) and return {userTimezone, timeString, date,
weekDay, hourNum, greeting}, update both components to call
useUserLocalTime(...) and use the returned values, and ensure the hook preserves
the same fallback behavior and error logging when user_timezone is invalid.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3bdd5dd5-a2ca-45ac-b15d-bc3fd894e7d9

📥 Commits

Reviewing files that changed from the base of the PR and between 388502a and 9e47a43.

📒 Files selected for processing (21)
  • apps/web/core/components/home/user-greetings.tsx
  • apps/web/core/components/user/user-greetings.tsx
  • packages/i18n/src/locales/cs/translations.ts
  • packages/i18n/src/locales/de/translations.ts
  • packages/i18n/src/locales/en/translations.ts
  • packages/i18n/src/locales/es/translations.ts
  • packages/i18n/src/locales/fr/translations.ts
  • packages/i18n/src/locales/id/translations.ts
  • packages/i18n/src/locales/it/translations.ts
  • packages/i18n/src/locales/ja/translations.ts
  • packages/i18n/src/locales/ko/translations.ts
  • packages/i18n/src/locales/pl/translations.ts
  • packages/i18n/src/locales/pt-BR/translations.ts
  • packages/i18n/src/locales/ro/translations.ts
  • packages/i18n/src/locales/ru/translations.ts
  • packages/i18n/src/locales/sk/translations.ts
  • packages/i18n/src/locales/tr-TR/translations.ts
  • packages/i18n/src/locales/ua/translations.ts
  • packages/i18n/src/locales/vi-VN/translations.ts
  • packages/i18n/src/locales/zh-CN/translations.ts
  • packages/i18n/src/locales/zh-TW/translations.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/i18n/src/locales/cs/translations.ts
  • packages/i18n/src/locales/tr-TR/translations.ts
🚧 Files skipped from review as they are similar to previous changes (12)
  • packages/i18n/src/locales/ro/translations.ts
  • packages/i18n/src/locales/de/translations.ts
  • packages/i18n/src/locales/pl/translations.ts
  • packages/i18n/src/locales/ja/translations.ts
  • packages/i18n/src/locales/ko/translations.ts
  • packages/i18n/src/locales/es/translations.ts
  • packages/i18n/src/locales/ua/translations.ts
  • packages/i18n/src/locales/pt-BR/translations.ts
  • packages/i18n/src/locales/fr/translations.ts
  • packages/i18n/src/locales/id/translations.ts
  • packages/i18n/src/locales/ru/translations.ts
  • packages/i18n/src/locales/sk/translations.ts

@aaryan610
Copy link
Copy Markdown
Member

Hey @MinitJain, thanks for fixing this bug! 🙌 I do have a small piece of feedback though- using “Good night” as a greeting might not be ideal since it’s usually used as a farewell rather than a greeting.

Let’s simplify the greetings to the following time ranges:

Time Greeting
5:00-11:59 Morning
12:00-16:59 Afternoon
17:00-4:59 Evening

Per maintainer feedback, "Good night" is a farewell not a greeting.
Simplifies to three buckets: morning (5-11), afternoon (12-16),
evening (17-4).

Extracts duplicated timezone validation, Intl formatting, and daypart
logic into a shared useGreeting hook to eliminate future drift between
the two identical components.

Removes greetings.night key from all 19 locale files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@MinitJain
Copy link
Copy Markdown
Author

Hey @aaryan610, thanks for the review : )
Makes total sense, "Good night" is definitely a farewell.
Updated the thresholds to your suggestion (morning 5-11, afternoon 12-16, evening 17-4)
and removed the night bucket entirely. Also extracted the shared timezone and formatting logic into a useGreeting hook to avoid duplication between the two components.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
packages/i18n/src/locales/ru/translations.ts (1)

500-505: Remove the stale top-level night entry if the hook is three-bucket only.

greetings now contains only morning, afternoon, and evening, so keeping night at the top level leaves this locale schema out of sync with the current greeting behavior.

♻️ Proposed cleanup
-  night: "ночи",
   greetings: {
     morning: "Доброе утро, {first_name} {last_name}",
     afternoon: "Добрый день, {first_name} {last_name}",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/ru/translations.ts` around lines 500 - 505, Remove
the stale top-level "night" translation entry from the translations object so
the locale schema matches the three-bucket greeting behavior; locate the "night"
key (top-level) and delete it, leaving only the nested greetings object with
"morning", "afternoon", and "evening" keys (references: "night" and "greetings"
in translations.ts).
packages/i18n/src/locales/fr/translations.ts (1)

501-506: Keep the locale keys consistent with the simplified greeting model.

Since greetings no longer includes a night template, the top-level night key should be removed if the app no longer emits a night greeting bucket.

♻️ Proposed cleanup
-  night: "nuit",
   greetings: {
     morning: "Bonjour, {first_name} {last_name}",
     afternoon: "Bon après-midi, {first_name} {last_name}",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/fr/translations.ts` around lines 501 - 506, The
translations object contains a top-level "night" key that is inconsistent with
the simplified greetings model which now nests templates under "greetings";
remove the standalone "night" key from this file so only the "greetings" object
(with morning, afternoon, evening templates) defines greeting text, ensuring any
code referencing greetings uses greetings.morning/afternoon/evening rather than
a top-level night symbol.
packages/i18n/src/locales/tr-TR/translations.ts (1)

493-498: Remove the stale night key from the three-bucket locale shape.

The current greeting flow no longer has a night bucket, while greetings correctly only defines morning, afternoon, and evening. Keeping night here leaves an unused fourth bucket and can drift from the intended locale schema.

♻️ Proposed cleanup
-  night: "gece",
   greetings: {
     morning: "Günaydın, {first_name} {last_name}",
     afternoon: "İyi günler, {first_name} {last_name}",
     evening: "İyi akşamlar, {first_name} {last_name}",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/tr-TR/translations.ts` around lines 493 - 498,
Remove the stale top-level "night" key from the translations export in
translations.ts so the locale shape matches the three-bucket greetings
structure; locate the "night" identifier near the "greetings" object (which
already defines morning, afternoon, evening) and delete that "night" entry to
avoid the unused fourth bucket.
packages/i18n/src/locales/ko/translations.ts (1)

485-485: Remove the stale night key if the three-bucket scheme is final.

The Korean value is localized now, but useGreeting cannot return night, so this added key is dead translation data under the current contract.

Suggested cleanup
-  night: "밤",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/ko/translations.ts` at line 485, Remove the stale
"night" translation entry from the Korean translations object because
useGreeting() never returns "night" under the finalized three-bucket scheme;
locate the "night" key in translations.ts and delete that key/value pair, and
then run a quick search for "night" and for the translations key reference to
ensure there are no remaining usages or tests expecting that identifier (update
any test fixtures if needed).
packages/i18n/src/locales/id/translations.ts (1)

497-497: Remove the stale night key if the three-bucket scheme is final.

useGreeting now returns only "morning" | "afternoon" | "evening", so this new top-level night label is no longer consumed and leaves the locale shape inconsistent with the finalized behavior.

Suggested cleanup
-  night: "dini hari",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/src/locales/id/translations.ts` at line 497, The locale file
contains a stale top-level label "night" that is no longer used because
useGreeting() only returns "morning" | "afternoon" | "evening"; remove the
"night" entry from translations.ts (the line night: "dini hari",) so the
Indonesian locale shape matches the finalized three-bucket scheme and update any
related locale type/checks if necessary to avoid unused-key warnings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/i18n/src/locales/vi-VN/translations.ts`:
- Around line 498-503: Remove the stale top-level translation key "night" from
the translations object (the unused symbol night) so only the greetings object
with keys morning/afternoon/evening remains; locate the translations.ts file and
delete the line defining night: "Buổi đêm" (leaving greetings: { morning,
afternoon, evening } intact), and then apply the same removal across other
locale translation files to keep them consistent.

---

Nitpick comments:
In `@packages/i18n/src/locales/fr/translations.ts`:
- Around line 501-506: The translations object contains a top-level "night" key
that is inconsistent with the simplified greetings model which now nests
templates under "greetings"; remove the standalone "night" key from this file so
only the "greetings" object (with morning, afternoon, evening templates) defines
greeting text, ensuring any code referencing greetings uses
greetings.morning/afternoon/evening rather than a top-level night symbol.

In `@packages/i18n/src/locales/id/translations.ts`:
- Line 497: The locale file contains a stale top-level label "night" that is no
longer used because useGreeting() only returns "morning" | "afternoon" |
"evening"; remove the "night" entry from translations.ts (the line night: "dini
hari",) so the Indonesian locale shape matches the finalized three-bucket scheme
and update any related locale type/checks if necessary to avoid unused-key
warnings.

In `@packages/i18n/src/locales/ko/translations.ts`:
- Line 485: Remove the stale "night" translation entry from the Korean
translations object because useGreeting() never returns "night" under the
finalized three-bucket scheme; locate the "night" key in translations.ts and
delete that key/value pair, and then run a quick search for "night" and for the
translations key reference to ensure there are no remaining usages or tests
expecting that identifier (update any test fixtures if needed).

In `@packages/i18n/src/locales/ru/translations.ts`:
- Around line 500-505: Remove the stale top-level "night" translation entry from
the translations object so the locale schema matches the three-bucket greeting
behavior; locate the "night" key (top-level) and delete it, leaving only the
nested greetings object with "morning", "afternoon", and "evening" keys
(references: "night" and "greetings" in translations.ts).

In `@packages/i18n/src/locales/tr-TR/translations.ts`:
- Around line 493-498: Remove the stale top-level "night" key from the
translations export in translations.ts so the locale shape matches the
three-bucket greetings structure; locate the "night" identifier near the
"greetings" object (which already defines morning, afternoon, evening) and
delete that "night" entry to avoid the unused fourth bucket.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1fbb7e69-40e8-482f-8120-6f1c779a7d33

📥 Commits

Reviewing files that changed from the base of the PR and between 9e47a43 and bab77e6.

📒 Files selected for processing (22)
  • apps/web/core/components/home/user-greetings.tsx
  • apps/web/core/components/user/user-greetings.tsx
  • apps/web/core/hooks/use-greeting.ts
  • packages/i18n/src/locales/cs/translations.ts
  • packages/i18n/src/locales/de/translations.ts
  • packages/i18n/src/locales/en/translations.ts
  • packages/i18n/src/locales/es/translations.ts
  • packages/i18n/src/locales/fr/translations.ts
  • packages/i18n/src/locales/id/translations.ts
  • packages/i18n/src/locales/it/translations.ts
  • packages/i18n/src/locales/ja/translations.ts
  • packages/i18n/src/locales/ko/translations.ts
  • packages/i18n/src/locales/pl/translations.ts
  • packages/i18n/src/locales/pt-BR/translations.ts
  • packages/i18n/src/locales/ro/translations.ts
  • packages/i18n/src/locales/ru/translations.ts
  • packages/i18n/src/locales/sk/translations.ts
  • packages/i18n/src/locales/tr-TR/translations.ts
  • packages/i18n/src/locales/ua/translations.ts
  • packages/i18n/src/locales/vi-VN/translations.ts
  • packages/i18n/src/locales/zh-CN/translations.ts
  • packages/i18n/src/locales/zh-TW/translations.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/i18n/src/locales/es/translations.ts
🚧 Files skipped from review as they are similar to previous changes (12)
  • apps/web/core/components/home/user-greetings.tsx
  • apps/web/core/components/user/user-greetings.tsx
  • packages/i18n/src/locales/pl/translations.ts
  • packages/i18n/src/locales/ja/translations.ts
  • packages/i18n/src/locales/pt-BR/translations.ts
  • packages/i18n/src/locales/en/translations.ts
  • packages/i18n/src/locales/zh-TW/translations.ts
  • packages/i18n/src/locales/de/translations.ts
  • packages/i18n/src/locales/cs/translations.ts
  • packages/i18n/src/locales/ua/translations.ts
  • packages/i18n/src/locales/ro/translations.ts
  • packages/i18n/src/locales/sk/translations.ts

Comment thread packages/i18n/src/locales/vi-VN/translations.ts Outdated
MinitJain and others added 2 commits April 22, 2026 09:32
…rom screen readers

- Memoize all four Intl.DateTimeFormat instances on userTimezone so
  formatter objects are only recreated when the timezone changes, not
  on every 60-second render tick
- Add aria-hidden="true" to the decorative emoji <div> in both
  UserGreetingsView components so screen readers skip it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The top-level night: key was never referenced in app code.
Only the greetings.{morning,afternoon,evening} nested keys are used.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@MinitJain
Copy link
Copy Markdown
Author

Hey @sriramveeraghanta
I have iterated on all CodeRabbit suggestions. Waiting for your approval. Let me know if you'd like any more changes!

@MinitJain
Copy link
Copy Markdown
Author

The PR fixes a timezone mismatch bug on the greeting component where the greeting text
and displayed time were reading from two different clocks.
CodeRabbit's suggestions have all been addressed across multiple commits.

@sriramveeraghanta
Copy link
Copy Markdown
Member

@MinitJain Your changes looks good to me but the problem is useCurrentTime hook. Ideally at the place of greeting we just need to take the local time of the user not the current time from the timezone he setup.

…zone

Greeting should reflect where the user physically is, not the timezone
they configured in Plane settings. Removed userTimezone from all
Intl.DateTimeFormat calls so formatters fall back to browser locale.
@MinitJain
Copy link
Copy Markdown
Author

Hey @sriramveeraghanta
Thanks for the feedback!

I have removed the user_timezone from all Intl.DateTimeFormat calls in useGreeting.
Now the greeting uses the browser's local timezone directly.

Also dropped the userTimezone validation logic since it's no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants