Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #835 代码提示自动补全国际化问题 #840

Merged
merged 3 commits into from
Jul 11, 2024
Merged
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
8 changes: 4 additions & 4 deletions src/core/hooks/SuggestList.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,14 @@ const MoreSuggestList = [
},
{
icon: 'FullWidth',
label: '行内代码',
label: 'inlineCode',
keyword: '`',
value: '``',
goLeft: 1,
},
{
icon: 'FullWidth',
label: '代码块',
label: 'codeBlock',
keyword: '`',
value: '```\n\n```\n',
goTop: 2,
Expand Down Expand Up @@ -316,10 +316,10 @@ export function allSuggestList(keyword, locales) {
const systemSuggestList = [].concat(SystemSuggestList);
const otherSuggestList = [].concat(OtherSuggestList);
systemSuggestList.forEach((item) => {
item.label = locales ? locales[item.label] : item.label;
item.label = locales[item.label] || item.label;
});
otherSuggestList.forEach((item) => {
item.label = locales ? locales[item.label] : item.label;
item.label = locales[item.label] || item.label;
});
if (keyword[0] === '/' || keyword[0] === '、' || addonsKeywords.includes(keyword[0])) {
systemSuggestList.forEach((item) => {
Expand Down
3 changes: 2 additions & 1 deletion src/core/hooks/Suggester.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ export default class Suggester extends SyntaxBase {

this.suggester = {};
const defaultSuggest = [];
const that = this;
// 默认的唤醒关键字
for (const suggesterKeyword of suggesterKeywords) {
defaultSuggest.push({
keyword: suggesterKeyword,
suggestList(_word, callback) {
// 将word全转成小写
const word = _word.toLowerCase();
const systemSuggestList = allSuggestList(suggesterKeyword, this.$locale);
const systemSuggestList = allSuggestList(suggesterKeyword, that.$locale);
// 加个空格就直接退出联想
if (/^\s$/.test(word)) {
callback(false);
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en_US.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,7 @@ export default {
superLarge: 'Super Large',
detailDefaultContent:
'Click to expand more\nContent\n++- Expand by default\nContent\n++ Collapse by default\nContent',
inlineCode: 'Inline Code',
codeBlock: 'Code Block',
editShortcutKeyConfigTip: 'double click shortcut key area to edit',
};
2 changes: 2 additions & 0 deletions src/locales/zh_CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,7 @@ export default {
large: '大',
superLarge: '特大',
detailDefaultContent: '点击展开更多\n内容\n++- 默认展开\n内容\n++ 默认收起\n内容',
inlineCode: '行内代码',
codeBlock: '代码块',
editShortcutKeyConfigTip: '双击快捷键区域编辑快捷键',
};
Loading