• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

MonacoEditor Diff Localization

The diff editor can be translated like the code editor, with a built-in locale or your own translation file (localeUrl).

MonacoDiffEditor Tag Documentation

Inline Monaco diff editor.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered Boolean false generated Unique identifier of the component in a namingContainer.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
extender String false Extender script: JavaScript expression that evaluates to an extender instance.
overflowWidgetsDomNode String false Search expression for overflow widgets DOM node.

MonacoDiffEditorFramed Tag Documentation

Framed Monaco diff editor (iframe).

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered Boolean false generated Unique identifier of the component in a namingContainer.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
extender String false URL to an extender script loaded into the iframe.
iframeUrlParams Object false Additional URL params added to the iframe URL.
Tag Documentation Widget Source Basic Localization Events Theme Extender Diff Diff Localization Diff Events Diff Theme Diff Extender
Custom Localization (diff editor)

Monaco comes with translations for most major languages. To provide your own, set localeUrl to a JavaScript file that writes the translation to window.MonacoEnvironment.Locale, see the Japanese localization file. The editor below is in Hindi (right click to open the context menu); the translation is nonsensical and only illustrates how to create your own.

Usage


<style>
    .monacoEditorBox {
        border: 1px solid var(--p-content-border-color);
        min-width: 0;
    }
</style>
<h:outputScript library="js" name="monacoColorScheme.js"/>

<div class="card">
    <h5>Custom Localization (diff editor)</h5>
    <p>
        Monaco comes with translations for most major languages. To provide your own, set <code>localeUrl</code> to a JavaScript file that writes the translation to <code>window.MonacoEnvironment.Locale</code>, see the <a href="#{resource['primefaces-extensions:monacoeditor/locale/ja.js']}" target="_blank" rel="noopener noreferrer">Japanese localization file</a>. The editor below is in Hindi (right click to open the context menu); the translation is nonsensical and only illustrates how to create your own.
    </p>
    <h:form id="formCustomLocalizationDiff">
        <p:selectOneButton id="type" value="#{monacoEditorController.type}" styleClass="monacoSync">
            <f:selectItem itemLabel="Inline" itemValue="inline" />
            <f:selectItem itemLabel="Iframe" itemValue="framed" />
            <p:ajax process="@form" update="@(.monacoSync)" />
        </p:selectOneButton>

        <h:panelGroup id="monacoEditorWrapper" layout="block" styleClass="monacoEditorBox monacoSync">
            <pe:monacoDiffEditor id="monacoEditor" widgetVar="monacoEditorLocalization"
                oninitialized="monacoFollowScheme.call(this)"
                rendered="#{monacoEditorController.type eq 'inline'}"
                value="#{monacoEditorController.valueDiff}"
                locale="hi"
                localeUrl="#{resource['other/hindi.js']}"
                editorOptions="#{monacoEditorController.editorOptionsDiff}"
                language="#{monacoEditorController.language}"
                width="100%" height="400px"
                autoResize="true"/>

            <pe:monacoDiffEditorFramed id="monacoEditorFramed" widgetVar="monacoEditorFramedLocalization"
                oninitialized="monacoFollowScheme.call(this)"
                rendered="#{monacoEditorController.type eq 'framed'}"
                value="#{monacoEditorController.valueFramedDiff}"
                locale="hi"
                localeUrl="#{resource['other/hindi.js']}"
                editorOptions="#{monacoEditorController.editorOptionsFramedDiff}"
                language="#{monacoEditorController.languageFramed}"
                width="100%" height="400px"
                autoResize="true"/>
        </h:panelGroup>
    </h:form>
</div>