Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, FieldGroup, TextInput, FieldLabel, FieldRow, Box } from '@rocket.chat/fuselage';
import { Field, FieldGroup, TextInput, FieldLabel, FieldRow, Box, FieldError } from '@rocket.chat/fuselage';
import { GenericModal } from '@rocket.chat/ui-client';
import { useEffect, useId } from 'react';
import { useForm, Controller } from 'react-hook-form';
Expand All @@ -15,8 +15,8 @@ const AddLinkComposerActionModal = ({ selectedText, onClose, onConfirm }: AddLin
const textField = useId();
const urlField = useId();

const { handleSubmit, setFocus, control } = useForm({
mode: 'onBlur',
const { handleSubmit, setFocus, control, formState } = useForm({
mode: 'onChange',
defaultValues: {
text: selectedText || '',
url: '',
Expand All @@ -40,6 +40,7 @@ const AddLinkComposerActionModal = ({ selectedText, onClose, onConfirm }: AddLin
confirmText={t('Add')}
onCancel={onClose}
wrapperFunction={(props) => <Box is='form' onSubmit={(e) => void submit(e)} {...props} />}
confirmDisabled={!formState.isValid}
title={t('Add_link')}
>
<FieldGroup>
Expand All @@ -52,8 +53,23 @@ const AddLinkComposerActionModal = ({ selectedText, onClose, onConfirm }: AddLin
<Field>
<FieldLabel htmlFor={urlField}>{t('URL')}</FieldLabel>
<FieldRow>
<Controller control={control} name='url' render={({ field }) => <TextInput autoComplete='off' id={urlField} {...field} />} />
<Controller
control={control}
name='url'
rules={{
pattern: {
value: /^https?:\/\/.+$/,
message: t("URL_must_start_with_'http://'_or_'https://'"),
},
required: {
value: true,
message: t(`URL_is_required`),
},
}}
render={({ field }) => <TextInput autoComplete='off' id={urlField} {...field} />}
/>
</FieldRow>
<FieldError>{formState.errors.url?.message}</FieldError>
</Field>
</FieldGroup>
</GenericModal>
Expand Down
2 changes: 2 additions & 0 deletions packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5422,6 +5422,8 @@
"UI_Use_Real_Name": "Use Real Name",
"URL": "URL",
"URLs": "URLs",
"URL_is_required": "URL is required",
"URL_must_start_with_'http://'_or_'https://'": "URL must start with 'http://' or 'https://'",
"UTC_Timezone": "UTC Timezone",
"UTF8_Channel_Names_Validation": "UTF8 Channel Names Validation",
"UTF8_Channel_Names_Validation_Description": "RegExp that will be used to validate channel names",
Expand Down
2 changes: 2 additions & 0 deletions packages/i18n/src/locales/es.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3866,6 +3866,8 @@
"UI_Use_Name_Avatar": "Usar iniciales del nombre completo para generar un avatar por defecto",
"UI_Use_Real_Name": "Usar nombre real",
"URL": "URL",
"URL_is_required": "La URL es obligatoria",
"URL_must_start_with_'http://'_or_'https://'": "La URL debe comenzar con 'http://' o 'https://'",
Comment on lines +3869 to +3870
Copy link
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

Add new i18n keys only in English and avoid special characters in key names

  • In this repo, new translation keys should be added to packages/i18n/src/locales/en.i18n.json only; other locales are populated via the external translation pipeline. Please remove the Spanish additions here and keep only the English source keys. Based on learnings
  • Also, the key "URL_must_start_with_'http://'or'https://'" contains quotes and URL text in the key name, which is non‑idiomatic and risky for tooling. Prefer a slug like URL_must_start_with_http_or_https.

Apply this removal in es.i18n.json (translations will come via the pipeline):

-  "URL_is_required": "La URL es obligatoria",
-  "URL_must_start_with_'http://'_or_'https://'": "La URL debe comenzar con 'http://' o 'https://'",

And in en.i18n.json, define stable keys such as:

  • URL_is_required: "URL is required"
  • URL_must_start_with_http_or_https: "URL must start with http:// or https://"

Can you confirm the translation pipeline is active for this branch so Spanish (and other locales) will sync automatically after adding the keys to en.i18n.json?


🏁 Script executed:

#!/bin/bash
# Check which locale files were modified in this PR
git diff --name-only HEAD~1 HEAD | grep -E 'i18n\.json' | head -20

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Check the full diff for both Spanish and English locale files
git diff HEAD~1 HEAD -- 'packages/i18n/src/locales/en.i18n.json' 'packages/i18n/src/locales/es.i18n.json' | head -100

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search for existing keys with special characters (quotes, slashes) in any locale file
rg -n "\"[^\"]*['\\/][^\"]*\"\\s*:" packages/i18n/src/locales/ | head -20

Length of output: 95


🏁 Script executed:

#!/bin/bash
# Check if URL-related keys exist anywhere in en.i18n.json
rg -n "URL" packages/i18n/src/locales/en.i18n.json

Length of output: 18522


Remove Spanish translations—keys already exist in English and will sync via translation pipeline

The keys URL_is_required and URL_must_start_with_'http://'_or_'https://' already exist in packages/i18n/src/locales/en.i18n.json. Per the repo's i18n workflow, new translations should only be added to the English locale file; other locales are populated via the external translation pipeline. Remove these entries from es.i18n.json:

-  "URL_is_required": "La URL es obligatoria",
-  "URL_must_start_with_'http://'_or_'https://'": "La URL debe comenzar con 'http://' o 'https://'",

The Spanish translations will be generated automatically once you confirm these keys are finalized in en.i18n.json.

📝 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
"URL_is_required": "La URL es obligatoria",
"URL_must_start_with_'http://'_or_'https://'": "La URL debe comenzar con 'http://' o 'https://'",
🤖 Prompt for AI Agents
In packages/i18n/src/locales/es.i18n.json around lines 3894-3895, remove the two
Spanish entries "URL_is_required" and
"URL_must_start_with_'http://'_or_'https://'" because these keys must be
maintained only in the English locale and other locales are populated by the
translation pipeline; ensure the keys remain present and correct in
packages/i18n/src/locales/en.i18n.json, save the file, and commit the deletion
(do not add or modify these keys in other locale files).

"UTC_Timezone": "Zona horaria UTC",
"UTF8_Channel_Names_Validation": "Validación de nombres de Channel UTF8",
"UTF8_Channel_Names_Validation_Description": "Regex que se usará para validar los nombres de canal",
Expand Down
3 changes: 3 additions & 0 deletions packages/i18n/src/locales/hi-IN.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4405,6 +4405,7 @@
"Test_Connection": "परीक्षण कनेक्शन",
"Test_Desktop_Notifications": "डेस्कटॉप सूचनाओं का परीक्षण करें",
"Test_LDAP_Search": "एलडीएपी खोज का परीक्षण करें",
"Text": "टेक्स्ट",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Do not add keys to non-English locale files (i18n workflow).

Per this repo’s i18n process, new keys should be added only to packages/i18n/src/locales/en.i18n.json; other locales are populated via the external translation pipeline and/or fall back to English. Please revert this addition in hi-IN and keep the source key in en only. Based on learnings

Apply: remove "Text" from hi-IN and rely on fallback until it lands via the translation pipeline.

🤖 Prompt for AI Agents
packages/i18n/src/locales/hi-IN.i18n.json around line 4456: The key "Text" was
added directly to the Hindi locale but per the repo i18n workflow new keys must
be added only to packages/i18n/src/locales/en.i18n.json and other locales should
wait for the translation pipeline or fallback to English; remove the "Text" key
entry from hi-IN.i18n.json (revert this addition) so the file matches the
canonical workflow and rely on fallback until the translation lands via the
pipeline.

"Texts": "ग्रंथों",
"Thank_You_For_Choosing_RocketChat": "रॉकेट.चैट चुनने के लिए धन्यवाद!",
"Thank_you_exclamation_mark": "धन्यवाद!",
Expand Down Expand Up @@ -4594,6 +4595,8 @@
"UI_Use_Real_Name": "वास्तविक नाम का प्रयोग करें",
"URL": "यूआरएल",
"URLs": "यूआरएल",
"URL_is_required": "यूआरएल आवश्यक है",
"URL_must_start_with_'http://'_or_'https://'": "यूआरएल की शुरुआत 'http://' या 'https://' से होनी चाहिए।",
Comment on lines +4598 to +4599
Copy link
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

URL validation strings should not be added in hi-IN; keep only in en and let the pipeline translate.

  • Move/remove these from hi-IN; add them (or keep them) in en.i18n.json only. Based on learnings
  • Optional: prefer a more stable key (e.g., URL_must_start_with_scheme) with placeholders in the value instead of embedding 'http://' in the key.

To verify duplication and key placement across locales, run:


🏁 Script executed:

#!/bin/bash
# Check where the new keys appear
rg -nP --glob 'packages/i18n/src/locales/*.json' \
  -e '"URL_is_required"\s*:' \
  -e '"URL_must_start_with_\\'http://\\'_or_\\'https://\\'"\s*:' \
  -e '"Text"\s*:'

# Ensure only en.i18n.json contains the new URL validation keys
rg -nP --glob 'packages/i18n/src/locales/*.json' '"URL_is_required"\s*:' | grep -v '/en.i18n.json' && echo "Found outside en (should be moved)" || echo "OK: only in en"
rg -nP --glob 'packages/i18n/src/locales/*.json' '"URL_must_start_with_\\'http://\\'_or_\\'https://\\'"\s*:' | grep -v '/en.i18n.json' && echo "Found outside en (should be moved)" || echo "OK: only in en"

Length of output: 1051


Remove URL validation keys from hi-IN; keep only in en.i18n.json and let the translation pipeline handle other locales.

Per the i18n workflow, new translation keys should only be added to packages/i18n/src/locales/en.i18n.json. The verification confirms "URL_is_required" is currently in multiple locales (es, pt-BR, hi-IN, and en) when it should only be in en. Remove these keys from hi-IN.i18n.json at lines 4651–4652.

🤖 Prompt for AI Agents
In packages/i18n/src/locales/hi-IN.i18n.json around lines 4651–4652, remove the
two URL validation keys ("URL_is_required" and
"URL_must_start_with_'http://'_or_'https://'") so they exist only in
en.i18n.json; after deleting those two entries, ensure the surrounding JSON
remains valid (remove or adjust the trailing comma on the preceding or following
line as needed).

"UTC_Timezone": "यूटीसी समय क्षेत्र",
"UTF8_Channel_Names_Validation": "UTF8 चैनल नाम सत्यापन",
"UTF8_Channel_Names_Validation_Description": "रेगएक्सपी जिसका उपयोग चैनल नामों को मान्य करने के लिए किया जाएगा",
Expand Down
2 changes: 2 additions & 0 deletions packages/i18n/src/locales/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5154,6 +5154,8 @@
"UI_Use_Real_Name": "Usar o nome verdadeiro",
"URL": "URL",
"URLs": "URLs",
"URL_is_required": "URL é obrigatório",
"URL_must_start_with_'http://'_or_'https://'": "A URL deve começar com 'http://' ou 'https://'",
Comment on lines +5157 to +5158
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Do not add new keys to non-English locales; revert these pt-BR insertions.

In this repo, new i18n keys must be introduced only in packages/i18n/src/locales/en.i18n.json. Other locales are populated via the external translation pipeline and fall back to English meanwhile. Please remove these additions from pt-BR and keep the keys only in en.i18n.json. Based on learnings

Apply this removal here:

-  "URL_is_required": "URL é obrigatório",
-  "URL_must_start_with_'http://'_or_'https://'": "A URL deve começar com 'http://' ou 'https://'",
📝 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
"URL_is_required": "URL é obrigatório",
"URL_must_start_with_'http://'_or_'https://'": "A URL deve começar com 'http://' ou 'https://'",
🤖 Prompt for AI Agents
packages/i18n/src/locales/pt-BR.i18n.json lines 5217-5218: these two new keys
("URL_is_required" and "URL_must_start_with_'http://' _or_'https://'") were
wrongly added to the pt-BR locale; remove these entries from this file so pt-BR
stays unchanged and only en.i18n.json contains new keys. Ensure you delete both
key/value lines and leave surrounding JSON valid (no trailing commas), and
confirm the corresponding keys exist in packages/i18n/src/locales/en.i18n.json.

"UTC_Timezone": "Fuso horário UTC",
"UTF8_Channel_Names_Validation": "Validação de nomes de canal UTF8",
"UTF8_Channel_Names_Validation_Description": "RegExp que será usado para validar nomes de canais",
Expand Down