locals init ...
This commit is contained in:
parent
db34038acc
commit
03e0d08623
@ -165,7 +165,7 @@ const Chat = forwardRef<ChatRef, ChatProps>((props, ref) => {
|
||||
}
|
||||
}
|
||||
|
||||
const [tab, setTab] = useState<'chat' | 'commands' | 'custom-mode'>('chat')
|
||||
const [tab, setTab] = useState<'chat' | 'commands' | 'custom-mode'>('custom-mode')
|
||||
const [selectedSerializedNodes, setSelectedSerializedNodes] = useState<BaseSerializedNode[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -14,6 +14,8 @@ import { modes as buildinModes } from '../../utils/modes';
|
||||
import { openOrCreateMarkdownFile } from '../../utils/obsidian';
|
||||
import { PromptGenerator, getFullLanguageName } from '../../utils/prompt-generator';
|
||||
|
||||
import { t } from '../../lang/helpers';
|
||||
|
||||
const CustomModeView = () => {
|
||||
const app = useApp()
|
||||
|
||||
@ -173,7 +175,7 @@ const CustomModeView = () => {
|
||||
{/* Mode configuration title and buttons */}
|
||||
<div className="infio-custom-modes-header">
|
||||
<div className="infio-custom-modes-title">
|
||||
<h2>Mode Configuration</h2>
|
||||
<h2>{t('prompt.title')}</h2>
|
||||
</div>
|
||||
{/* <div className="infio-custom-modes-actions">
|
||||
<button className="infio-custom-modes-btn">
|
||||
@ -187,7 +189,7 @@ const CustomModeView = () => {
|
||||
|
||||
{/* Create mode tip */}
|
||||
<div className="infio-custom-modes-tip">
|
||||
Click + to create a new mode
|
||||
{t('prompt.description')}
|
||||
</div>
|
||||
|
||||
{/* Mode selection area */}
|
||||
|
||||
79
src/lang/helpers.ts
Normal file
79
src/lang/helpers.ts
Normal file
@ -0,0 +1,79 @@
|
||||
//Solution copied from obsidian-kanban: https://github.com/mgmeyers/obsidian-kanban/blob/44118e25661bff9ebfe54f71ae33805dc88ffa53/src/lang/helpers.ts
|
||||
|
||||
import { moment } from "obsidian";
|
||||
|
||||
import ar from "./locale/ar";
|
||||
import cz from "./locale/cz";
|
||||
import da from "./locale/da";
|
||||
import de from "./locale/de";
|
||||
import en from "./locale/en";
|
||||
import enGB from "./locale/en-gb";
|
||||
import es from "./locale/es";
|
||||
import fr from "./locale/fr";
|
||||
import hi from "./locale/hi";
|
||||
import hu from "./locale/hu";
|
||||
import id from "./locale/id";
|
||||
import it from "./locale/it";
|
||||
import ja from "./locale/ja";
|
||||
import ko from "./locale/ko";
|
||||
import nl from "./locale/nl";
|
||||
import no from "./locale/no";
|
||||
import pl from "./locale/pl";
|
||||
import pt from "./locale/pt";
|
||||
import ptBR from "./locale/pt-br";
|
||||
import ro from "./locale/ro";
|
||||
import ru from "./locale/ru";
|
||||
import tr from "./locale/tr";
|
||||
import zhCN from "./locale/zh-cn";
|
||||
import zhTW from "./locale/zh-tw";
|
||||
|
||||
const localeMap: { [k: string]: Partial<typeof en> } = {
|
||||
en,
|
||||
ar,
|
||||
cs: cz,
|
||||
da,
|
||||
de,
|
||||
"en-gb": enGB,
|
||||
es,
|
||||
fr,
|
||||
hi,
|
||||
id,
|
||||
it,
|
||||
ja,
|
||||
ko,
|
||||
nl,
|
||||
nn: no,
|
||||
pl,
|
||||
pt,
|
||||
"pt-br": ptBR,
|
||||
ro,
|
||||
ru,
|
||||
tr,
|
||||
"zh-cn": zhCN,
|
||||
"zh-tw": zhTW,
|
||||
hu,
|
||||
};
|
||||
|
||||
const locale = localeMap[moment.locale()];
|
||||
|
||||
export function t(str: string): any {
|
||||
if (!locale) {
|
||||
console.error({
|
||||
plugin: "infio-copilot",
|
||||
fn: t,
|
||||
where: "src/lang/helpers.ts",
|
||||
message: "Error: locale not found",
|
||||
data: moment.locale(),
|
||||
});
|
||||
}
|
||||
|
||||
const path = str.split('.');
|
||||
let result = locale || en;
|
||||
|
||||
for (const key of path) {
|
||||
result = result[key] || (en && en[key]);
|
||||
if (result === undefined) return str;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
3
src/lang/locale/ar.ts
Normal file
3
src/lang/locale/ar.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// العربية
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/cz.ts
Normal file
3
src/lang/locale/cz.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// čeština
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/da.ts
Normal file
3
src/lang/locale/da.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// Dansk
|
||||
|
||||
export default {};
|
||||
4
src/lang/locale/de.ts
Normal file
4
src/lang/locale/de.ts
Normal file
@ -0,0 +1,4 @@
|
||||
// import { APPNAME, MINEXCALIDRAWVERSION } from "src/constants/constants";
|
||||
|
||||
// Deutsch
|
||||
export default {}
|
||||
3
src/lang/locale/en-gb.ts
Normal file
3
src/lang/locale/en-gb.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// British English
|
||||
|
||||
export default {};
|
||||
12
src/lang/locale/en.ts
Normal file
12
src/lang/locale/en.ts
Normal file
@ -0,0 +1,12 @@
|
||||
// import { APPNAME, MINEXCALIDRAWVERSION } from "src/constants/constants";
|
||||
|
||||
//Magyar
|
||||
export default {
|
||||
prompt: {
|
||||
"title": "Prompts",
|
||||
"description": "Click + to create a new mode",
|
||||
"modeName": "Mode Name",
|
||||
"modeNameDescription": "Mode Description",
|
||||
"modeNamePlaceholder": "Enter mode name...",
|
||||
}
|
||||
}
|
||||
5
src/lang/locale/es.ts
Normal file
5
src/lang/locale/es.ts
Normal file
@ -0,0 +1,5 @@
|
||||
// import { APPNAME, MINEXCALIDRAWVERSION } from "src/constants/constants";
|
||||
|
||||
//Español
|
||||
export default {}
|
||||
|
||||
3
src/lang/locale/fr.ts
Normal file
3
src/lang/locale/fr.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// français
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/hi.ts
Normal file
3
src/lang/locale/hi.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// हिन्दी
|
||||
|
||||
export default {};
|
||||
5
src/lang/locale/hu.ts
Normal file
5
src/lang/locale/hu.ts
Normal file
@ -0,0 +1,5 @@
|
||||
// import { APPNAME, MINEXCALIDRAWVERSION } from "src/constants/constants";
|
||||
|
||||
//Magyar
|
||||
export default {}
|
||||
|
||||
3
src/lang/locale/id.ts
Normal file
3
src/lang/locale/id.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// Bahasa Indonesia
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/it.ts
Normal file
3
src/lang/locale/it.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// Italiano
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/ja.ts
Normal file
3
src/lang/locale/ja.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// 日本語
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/ko.ts
Normal file
3
src/lang/locale/ko.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// 한국어
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/nl.ts
Normal file
3
src/lang/locale/nl.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// Nederlands
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/no.ts
Normal file
3
src/lang/locale/no.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// Norsk
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/pl.ts
Normal file
3
src/lang/locale/pl.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// język polski
|
||||
|
||||
export default {};
|
||||
4
src/lang/locale/pt-br.ts
Normal file
4
src/lang/locale/pt-br.ts
Normal file
@ -0,0 +1,4 @@
|
||||
// Português do Brasil
|
||||
// Brazilian Portuguese
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/pt.ts
Normal file
3
src/lang/locale/pt.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// Português
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/ro.ts
Normal file
3
src/lang/locale/ro.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// Română
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/ru.ts
Normal file
3
src/lang/locale/ru.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// русский
|
||||
|
||||
export default {};
|
||||
3
src/lang/locale/tr.ts
Normal file
3
src/lang/locale/tr.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// Türkçe
|
||||
|
||||
export default {};
|
||||
8
src/lang/locale/zh-cn.ts
Normal file
8
src/lang/locale/zh-cn.ts
Normal file
@ -0,0 +1,8 @@
|
||||
// import { APPNAME, MINEXCALIDRAWVERSION } from "src/constants/constants";
|
||||
|
||||
// 简体中文
|
||||
export default {
|
||||
prompt: {
|
||||
"title": "模型提示词设置",
|
||||
}
|
||||
};
|
||||
3
src/lang/locale/zh-tw.ts
Normal file
3
src/lang/locale/zh-tw.ts
Normal file
@ -0,0 +1,3 @@
|
||||
// 繁體中文
|
||||
|
||||
export default {};
|
||||
Loading…
x
Reference in New Issue
Block a user