40
40
'translator' ,
41
41
]
42
42
unused_translations = []
43
+ missing_translations = []
43
44
44
45
45
46
def translate (m ):
46
- trans = translation_dict .get (m .group (1 ), m .group (1 ))
47
+ s = m .group (1 )
48
+ trans = translation_dict .get (s , None )
47
49
if not trans :
48
- trans = m .group (1 )
50
+ trans = s
51
+ missing_translations .append (s )
49
52
else :
50
- used_translations .append (m . group ( 1 ) )
53
+ used_translations .append (s )
51
54
52
55
return trans
53
56
@@ -387,7 +390,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
387
390
'{{outliner interchange format for text only. Formatting, images and files are not included.}}' ,
388
391
'title: "{{Export status}}"' ,
389
392
'showError("{{Choose export type first please}}"' ,
390
- ' throw new Error(`{{Unrecognized type ${defaultType}}}`' ,
393
+ " throw new Error(`{{Unrecognized type}}" ,
391
394
]
392
395
replace_in_file (file_path , translation )
393
396
@@ -683,8 +686,8 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
683
686
'>{{This action will create a new copy of the database and do a light anonymization on it — specifically only content of all notes will be removed, but titles and attributes will remain. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.}}<' ,
684
687
'>{{You can decide yourself if you want to provide a fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.}}<' ,
685
688
'>{{Save lightly anonymized database}}<' ,
686
- 'showMessage(`{{ Created fully anonymized database in ${resp.anonymizedFilePath}`}}' ,
687
- 'showMessage(`{{ Created lightly anonymized database in ${resp.anonymizedFilePath}`}}' ,
689
+ 'showMessage({{` Created fully anonymized database in ${resp.anonymizedFilePath}`}}' ,
690
+ 'showMessage({{` Created lightly anonymized database in ${resp.anonymizedFilePath}`}}' ,
688
691
'showMessage("{{Creating fully anonymized database...}}"' ,
689
692
'showMessage("{{Creating lightly anonymized database...}}"' ,
690
693
'showError("{{Could not create anonymized database, check backend logs for details}}"' ,
@@ -697,7 +700,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
697
700
'>{{Database Integrity Check}}<' ,
698
701
'>{{This will check that the database is not corrupted on the SQLite level. It might take some time, depending on the DB size.}}<' ,
699
702
'>{{Check database integrity}}<' ,
700
- 'showMessage(`{{Integrity check failed: ${JSON.stringify(results, null, 2)}}}` ' ,
703
+ 'showMessage(`{{Integrity check failed:}} ' ,
701
704
'showMessage("{{Checking database integrity...}}"' ,
702
705
'showMessage("{{Integrity check succeeded - no problems found.}}"' ,
703
706
]
@@ -1024,8 +1027,10 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
1024
1027
'{{Underlined font}}' ,
1025
1028
'{{Font with color}}' ,
1026
1029
'{{Font with background color}}' ,
1030
+ '{{Highlists List visibility}}' ,
1027
1031
'{{Highlights List visibility}}' ,
1028
1032
'{{You can hide the hightlights widget per-note by adding a <code>#hideHighlightWidget</code> label.}}' ,
1033
+ '{{You can hide the highlights widget per-note by adding a <code>#hideHighlightWidget</code> label.}}' ,
1029
1034
]
1030
1035
replace_in_file (file_path , translation )
1031
1036
@@ -1173,17 +1178,17 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
1173
1178
1174
1179
file_path = 'src/public/app/services/froca.js'
1175
1180
translation = [
1176
- 'throw new Error( `{{Search note ${note.noteId} failed: ${searchResultNoteIds}}}`' ,
1181
+ " `{{Search note ' ${note.noteId}' failed:}}" ,
1177
1182
'throw new Error("{{Empty noteId}}"' ,
1178
- ' logError(`{{Not existing branch ${branchId}}}`' ,
1183
+ " logError(`{{Not existing branch ' ${branchId}' }}`)" ,
1179
1184
' logError(`{{Could not find branchId for parent=${parentNoteId}, child=${childNoteId} since child does not exist}}`' ,
1180
1185
]
1181
1186
replace_in_file (file_path , translation )
1182
1187
1183
1188
file_path = 'src/public/app/services/froca_updater.js'
1184
1189
translation = [
1185
- ' throw new Error(`{{Unknown entityName ${ec.entityName}}}`' ,
1186
- """throw new Error(`{{ Can't process entity ${JSON.stringify(ec)} with error ${e.message} ${e.stack}}}` """ ,
1190
+ " throw new Error(`{{Unknown entityName ' ${ec.entityName}' }}`" ,
1191
+ """throw new Error({{` Can't process entity ${JSON.stringify(ec)} with error ${e.message} ${e.stack}`}}) """ ,
1187
1192
]
1188
1193
replace_in_file (file_path , translation )
1189
1194
@@ -1350,7 +1355,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
1350
1355
1351
1356
file_path = 'src/public/app/components/note_context.js'
1352
1357
translation = [
1353
- ' logError(`{{ Cannot resolve note path ${inputNotePath}}}` ' ,
1358
+ 'logError({{` Cannot resolve note path ${inputNotePath}`}}) ' ,
1354
1359
]
1355
1360
replace_in_file (file_path , translation )
1356
1361
@@ -1360,7 +1365,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
1360
1365
'title="{{Expand all children}}"' ,
1361
1366
'title="{{List view}}"' ,
1362
1367
'title="{{Grid view}}"' ,
1363
- 'throw new Error({{` Invalid view type ${type}`}} ' ,
1368
+ 'throw new Error(`{{ Invalid view type}} ${type}`' ,
1364
1369
]
1365
1370
replace_in_file (file_path , translation )
1366
1371
@@ -1693,7 +1698,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
1693
1698
'"{{Rename note}}"' ,
1694
1699
'>{{Rename note title to:}}<' ,
1695
1700
'>{{The given value is evaluated as JavaScript string and thus can be enriched with dynamic content via the injected }}<' ,
1696
- '>{{note}}<' ,
1701
+ # '>{{note}}<',
1697
1702
'>{{ variable (note being renamed). Examples:}}<' ,
1698
1703
'>{{Note}}<' ,
1699
1704
'>{{ - all matched notes are renamed to "Note"}}<' ,
@@ -1763,7 +1768,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
1763
1768
'>{{Convert attachment into note}}<' ,
1764
1769
'>{{Delete attachment}}<' ,
1765
1770
'"{{New attachment revision has been uploaded.}}"' ,
1766
- '"{{" Upload of a new attachment revision failed." }}"' ,
1771
+ '"{{Upload of a new attachment revision failed.}}"' ,
1767
1772
'"{{Opening attachment externally is available only from the detail page, please first click on the attachment detail first and repeat the action.}}"' ,
1768
1773
'{{Are you sure you want to delete attachment}}' ,
1769
1774
"{{Attachment '${this.attachment.title}' has been deleted.}}" ,
@@ -2091,7 +2096,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
2091
2096
translation = [
2092
2097
'title="{{Execute script}}"' ,
2093
2098
'title="{{Open Trilium API docs}}"' ,
2094
- 'showMessage(`{{SQL Console note has been saved into ${await treeService.getNotePathTitle(notePath)}}}` ' ,
2099
+ 'showMessage(`{{SQL Console note has been saved into}} ' ,
2095
2100
'showMessage("{{Opening API docs...}}"' ,
2096
2101
]
2097
2102
replace_in_file (file_path , translation )
@@ -2238,7 +2243,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
2238
2243
'title="{{Collapse all notes}}"' ,
2239
2244
'title="{{Expand all children}}"' ,
2240
2245
"title: '{{Book Properties}}" ,
2241
- ' throw new Error(`{{Invalid view type ${type}}}`' ,
2246
+ " throw new Error(`{{Invalid view type}} ' ${type}'`)" ,
2242
2247
' {{Collapse}}' ,
2243
2248
' {{Expand}}' ,
2244
2249
]
@@ -2354,8 +2359,8 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
2354
2359
"title: '{{Search Parameters}}" ,
2355
2360
'showMessage("{{Search note has been saved into }}' ,
2356
2361
"showMessage('{{Actions have been executed.}}'" ,
2357
- ' logError(`{{Unknown search option ${searchOptionName}}}` ' ,
2358
- """ logError(`{{ Parsing of attribute: '${actionAttr.value}' failed with error: ${e.message}}}` """ ,
2362
+ 'logError(`{{Unknown search option}}`) ' ,
2363
+ """logError({{` Parsing of attribute: '${actionAttr.value}' failed with error: ${e.message}`}}) """ ,
2359
2364
""" logError(`{{No action class for '${actionDef.name}' found.}}`""" ,
2360
2365
' {{Search & Execute actions}}' ,
2361
2366
' {{Save to note}}' ,
@@ -3330,14 +3335,21 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
3330
3335
else :
3331
3336
print ('no missing file, good!' )
3332
3337
print ('=====================================' )
3333
- unused_translations = [key for key in translation_dict if key not in used_translations ]
3338
+ unused_translations = [key for key in translation_dict if key and key not in used_translations ]
3334
3339
if unused_translations :
3335
3340
print ('unused_translations! \n ' )
3336
3341
for x in unused_translations :
3337
3342
print (x )
3338
3343
else :
3339
3344
print ('no unused translation, good!' )
3340
3345
print ('=====================================' )
3346
+ if missing_translations :
3347
+ print ('missing_translations! \n ' )
3348
+ for x in missing_translations :
3349
+ print (x )
3350
+ else :
3351
+ print ('no missing translation, good!' )
3352
+ print ('=====================================' )
3341
3353
3342
3354
# 尝试删除electron的缓存, 避免代码修改不生效的问题
3343
3355
# try delete electron cache, avoid code change does not take effect
0 commit comments