Skip to content

Commit

Permalink
添加自定义搜索引擎和自然排序功能的翻译
Browse files Browse the repository at this point in the history
  • Loading branch information
Nriver committed May 19, 2023
1 parent 05f42cc commit eb12615
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 2.trans.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
'>{{Sorting criteria}}<',
'>{{Sorting direction}}<',
'>{{Folders}}<',
'>{{Natural Sort}}<',
'>{{Sort }}<',
'>{{enter}}<',
' {{title}}',
Expand All @@ -625,6 +626,9 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
' {{ascending}}',
' {{descending}}',
' {{sort folders at the top}}',
'{{sort with respect to different character sorting and collation rules in different languages or regions.}}',
'{{Natural sort language}}',
'{{The language code for natural sort, e.g. "zh-CN" for Chinese.}}',
]
replace_in_file(file_path, translation)

Expand Down Expand Up @@ -878,6 +882,21 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
]
replace_in_file(file_path, translation)

file_path = 'src/public/app/widgets/type_widgets/options/other/search_engine.js'
translation = [
'>{{Search Engine}}<',
'>{{Custom search engine requires both a name and a URL to be set. If either of these is not set, DuckDuckGo will be used as the default search engine.}}<',
'>{{Predefined search engine templates}}<',
'>{{Bing}}<',
'>{{Baidu}}<',
'>{{Duckduckgo}}<',
'>{{Google}}<',
'>{{Custom search engine name}}<',
'>{{Custom search engine URL should include <code>{keyword}</code> as a placeholder for the search term.}}<',
'>{{Save}}<',
]
replace_in_file(file_path, translation)

file_path = 'src/public/app/widgets/type_widgets/options/other/tray.js'
translation = [
'>{{Tray}}<',
Expand Down Expand Up @@ -3453,6 +3472,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):

# 应用补丁
# apply patch
print(f'switch to dir: {BASE_PATH}')
os.chdir(BASE_PATH)
os.system('npm run webpack')

Expand Down Expand Up @@ -3525,4 +3545,11 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
for x in missing_files:
print(x)

# 尝试删除electron的缓存, 避免代码修改不生效的问题
# try delete electron cache, avoid code change does not take effect
try:
shutil.rmtree(os.path.expanduser('~/.config/Trilium Notes/'))
except:
pass

print('finished!')
13 changes: 13 additions & 0 deletions translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1626,4 +1626,17 @@
'{{executes when the attribute is changed of a note which defines this relation. This is triggered also when the attribute is deleted}}': '',
"{{note's attributes will be inherited even without a parent-child relationship, note's content and subtree will be added to instance notes if empty. See documentation for details.}}": '',
"{{note's attributes will be inherited even without a parent-child relationship. See template relation for a similar concept. See attribute inheritance in the documentation.}}": '',
'Search Engine': '',
'Custom search engine requires both a name and a URL to be set. If either of these is not set, DuckDuckGo will be used as the default search engine.': '',
'Predefined search engine templates': '',
'Bing': '',
'Baidu': '',
'Duckduckgo': '',
'Google': '',
'Custom search engine name': '',
'Custom search engine URL should include <code>{keyword}</code> as a placeholder for the search term.': '',
'Natural Sort': '',
'sort with respect to different character sorting and collation rules in different languages or regions.': '',
'Natural sort language': '',
'The language code for natural sort, e.g. "zh-CN" for Chinese.': '',
}
13 changes: 13 additions & 0 deletions translations_cn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,5 +1618,18 @@
"{{executes when the attribute is changed of a note which defines this relation. This is triggered also when the attribute is deleted}}": '当定义此关系的笔记的属性更改时执行。当删除属性时,也会触发此操作',
"{{note's attributes will be inherited even without a parent-child relationship, note's content and subtree will be added to instance notes if empty. See documentation for details.}}": '即使没有父子关系, 笔记的属性也会被继承, 如果为空, 则笔记的内容和子树将添加到实例笔记中. 有关详细信息请参阅文档.',
"{{note's attributes will be inherited even without a parent-child relationship. See template relation for a similar concept. See attribute inheritance in the documentation.}}": '即使没有父子关系, 笔记的属性也将被继承. 有关类似概念的模板关系, 请参阅文档中的属性继承.',
'Search Engine': '搜索引擎',
'Custom search engine requires both a name and a URL to be set. If either of these is not set, DuckDuckGo will be used as the default search engine.': '自定义搜索引擎需要设置名称和URL。如果其中任何一个未设置,将使用DuckDuckGo作为默认搜索引擎。',
'Predefined search engine templates': '预定义的搜索引擎模板',
'Bing': '必应',
'Baidu': '百度',
'Duckduckgo': 'DuckDuckGo',
'Google': '谷歌',
'Custom search engine name': '自定义搜索引擎名称',
'Custom search engine URL should include <code>{keyword}</code> as a placeholder for the search term.': '自定义搜索引擎的URL应该包含<code>{keyword}</code>作为搜索词的占位符。',
'Natural Sort': '自然排序',
'sort with respect to different character sorting and collation rules in different languages or regions.': '根据不同语言或地区的字符排序和排序规则进行排序。',
'Natural sort language': '自然排序语言',
'The language code for natural sort, e.g. "zh-CN" for Chinese.': '自然排序的语言代码, 例如中文的"zh-CN"',
'': '',
}

0 comments on commit eb12615

Please sign in to comment.