Skip to content

Commit e2251a3

Browse files
authored
Merge pull request #1723 from feifei325/i18n/fix_missing_settings_and_api
Fix internationalization issues on settings and prompt pages, and resolve rules file accessibility
2 parents 8265520 + 05c7245 commit e2251a3

40 files changed

+1734
-214
lines changed

webview-ui/src/components/prompts/PromptsView.tsx

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { vscode } from "../../utils/vscode"
2727
import { Tab, TabContent, TabHeader } from "../common/Tab"
2828
import i18next from "i18next"
2929
import { useAppTranslation } from "../../i18n/TranslationContext"
30+
import { Trans } from "react-i18next"
3031

3132
// Get all available groups that should show in prompts view
3233
const availableGroups = (Object.keys(TOOL_GROUPS) as ToolGroup[]).filter((group) => !TOOL_GROUPS[group].alwaysAvailable)
@@ -781,10 +782,38 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
781782
color: "var(--vscode-descriptionForeground)",
782783
marginTop: "5px",
783784
}}>
784-
{t("prompts:customInstructions.loadFromFile", {
785-
modeName: getCurrentMode()?.name || "Code",
786-
modeSlug: getCurrentMode()?.slug || "code",
787-
})}
785+
<Trans
786+
i18nKey="prompts:customInstructions.loadFromFile"
787+
values={{
788+
mode: getCurrentMode()?.name || "Code",
789+
slug: getCurrentMode()?.slug || "code",
790+
}}
791+
components={{
792+
span: (
793+
<span
794+
style={{
795+
color: "var(--vscode-textLink-foreground)",
796+
cursor: "pointer",
797+
textDecoration: "underline",
798+
}}
799+
onClick={() => {
800+
const currentMode = getCurrentMode()
801+
if (!currentMode) return
802+
803+
// Open or create an empty file
804+
vscode.postMessage({
805+
type: "openFile",
806+
text: `./.clinerules-${currentMode.slug}`,
807+
values: {
808+
create: true,
809+
content: "",
810+
},
811+
})
812+
}}
813+
/>
814+
),
815+
}}
816+
/>
788817
</div>
789818
</div>
790819
</div>
@@ -866,9 +895,32 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
866895

867896
{isSystemPromptDisclosureOpen && (
868897
<div className="text-xs text-vscode-descriptionForeground mt-2 ml-5">
869-
{t("prompts:advancedSystemPrompt.description", {
870-
modeSlug: getCurrentMode()?.slug || "code",
871-
})}
898+
<Trans
899+
i18nKey="prompts:advancedSystemPrompt.description"
900+
values={{
901+
slug: getCurrentMode()?.slug || "code",
902+
}}
903+
components={{
904+
span: (
905+
<span
906+
className="text-vscode-textLink-foreground cursor-pointer underline"
907+
onClick={() => {
908+
const currentMode = getCurrentMode()
909+
if (!currentMode) return
910+
911+
vscode.postMessage({
912+
type: "openFile",
913+
text: `./.roo/system-prompt-${currentMode.slug}`,
914+
values: {
915+
create: true,
916+
content: "",
917+
},
918+
})
919+
}}
920+
/>
921+
),
922+
}}
923+
/>
872924
</div>
873925
)}
874926
</div>
@@ -900,7 +952,30 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
900952
data-testid="global-custom-instructions-textarea"
901953
/>
902954
<div className="text-xs text-vscode-descriptionForeground mt-1.5 mb-10">
903-
{t("prompts:globalCustomInstructions.loadFromFile")}
955+
<Trans
956+
i18nKey="prompts:globalCustomInstructions.loadFromFile"
957+
components={{
958+
span: (
959+
<span
960+
style={{
961+
color: "var(--vscode-textLink-foreground)",
962+
cursor: "pointer",
963+
textDecoration: "underline",
964+
}}
965+
onClick={() =>
966+
vscode.postMessage({
967+
type: "openFile",
968+
text: "./.clinerules",
969+
values: {
970+
create: true,
971+
content: "",
972+
},
973+
})
974+
}
975+
/>
976+
),
977+
}}
978+
/>
904979
</div>
905980
</div>
906981

0 commit comments

Comments
 (0)