Language

General actions with language

  • get default language: .. code-block:: java

    DocumentLanguage defaultLang = Imcms.getServices().getDocumentLanguages().getDefault();

  • get document’s enabled languages: .. code-block:: java

    Imcms.getServices().getDocumentMapper().getDocument(“current document’s id”).getMeta().getEnabledLanguages();

    This code will return the Set<DocumentLanguage>, which can be used for choosing the right language and setting it.

  • set document’s language: .. code-block:: java

    Imcms.getServices().getDocumentMapper().getDocument(“current document’s id”).setLanguage(DocumentLanguage language);

  • set user’s language (not recommended): .. code-block:: java

    Imcms.getUser().getDocGetterCallback().setLanguage(DocumentLanguage language, boolean isDefaultLang);