[Resolved] registerFileUrl()
register package.nls.[lang].json
is ok, but l10n
failed
#706
yswang0927
started this conversation in
General
Replies: 2 comments 5 replies
-
It works the same way The only difference is you have to register each file individually using the returned |
Beta Was this translation helpful? Give feedback.
1 reply
-
I configured these: const { getApi, registerFileUrl } = registerExtension(
{
name: 'tsml-extension',
publisher: 'mycoder',
version: '1.0.0',
l10n: './l10n', // 👈
engines: {
vscode: '^1.100.0'
},
contributes: {
commands: [
{
command: 'tsml.run',
title: '%tsml.run.title%', // 👈
icon: '$(play)'
},
{
command: 'tsml.newFile',
title: '%tsml.newFile.title%', // 👈
icon: '$(new-file)'
}
]
}
}
);
// package.nls.[lang].json is ok 👈
registerFileUrl('package.nls.json', new URL('./package.nls.json', import.meta.url).href);
registerFileUrl('package.nls.zh-cn.json', new URL('./package.nls.zh-cn.json', import.meta.url).href);
// l10n failed 👈
registerFileUrl('./l10n/bundle.l10n.zh-cn.json', new URL('./l10n/bundle.l10n.zh-cn.json', import.meta.url).href);
void getApi().then(async (api) => {
api.commands.registerCommand('tsml.newFile', (dirUri: vscode.Uri) => {
api.window.showInputBox({
placeHolder: vscode.l10n.t('Input tsml file name'), // 👈
ignoreFocusOut: true,
validateInput: (value) => {
if (!value || value.trim().length === 0) {
return vscode.l10n.t('File name cannot be empty'); // 👈
}
if (value.includes('/') || value.includes('\\')) {
return vscode.l10n.t('File name cannot contain path separators'); // 👈
}
return null;
}
}).then(async (name) => {
// ...
});
}); bundle.l10n.zh-cn.json {
"Input tsml file name": "输入 TSML 文件名",
"File name cannot be empty": "文件名不能为空",
"File name cannot contain path separators": "文件名不能包含路径分隔符"
}
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I use
registerExtension()
to register my extension, how to config l10n and nls ?vscode extension supports config
l10n: './l10n'
andpackage.nls.[lang].json
, ourmonaco-vscode-api
how to supports it?Thanks!
========= Success! Update =========
Beta Was this translation helpful? Give feedback.
All reactions