-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
How to translate the editor UI to a different language? #629
Comments
Hey, thanks for answering. Already did. It works fine for the supported languages, the thing is: there is not a portuguese translation present on the files. That is why I ask if it's possible to add translation for a unsupported language. |
Ah, sorry I misunderstood. To be able to use packages like |
Hey, thanks for answering again. I still didn't get it right. Tried the following implementation: 'use client';
import Box from '@mui/material/Box';
import { useEffect } from 'react';
import { setLocaleData } from 'monaco-editor-nls';
// import pt_BR from 'monaco-editor-nls/locale/pt-br.json';
import pt_BR from '@/vscode-language-pack-pt-BR/translations/main.i18n.json';
export default function Poc() {
useEffect(() => {
setLocaleData(pt_BR.contents);
const monaco = require('monaco-editor/esm/vs/editor/editor.api');
monaco.editor.create(
document.getElementById('monaco-editor') as HTMLElement,
{
value: 'function x() {\n\tconsole.log("Hello world!");\n}',
language: 'javascript',
theme: 'vs-dark',
}
);
}, []);
return (
<Box
display="flex"
flexDirection={'column'}
alignItems="center"
justifyContent="center"
>
<div
id="monaco-editor"
style={{
width: '70%',
height: '500px',
}}
/>
</Box>
);
} The monaco-editor-nls recommends importing monaco after running the Do you have any idea of what I can do? Maybe with a different library or implementation form? Is there any way to access i18n running on monaco-editor and apply the translation? |
Describe the solution you'd like
I want to use the editor localized in a language not officially supported in the translation files, in this case, brazillian portuguese.
Describe alternatives you've considered
VS Code already has a portuguese translation, as you can find here. Already tried to use it with a library called monaco-editor-nls, but it didn't work when I tried like this:
Do you have any ideas of what I can do?
The text was updated successfully, but these errors were encountered: