-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80dd09e
commit 2f30f76
Showing
8 changed files
with
283 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
Language | ||
======== | ||
|
||
General actions with language (the java-code) | ||
""""""""""""""""""""""""""""""""""""""""""""" | ||
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().getDocumentLanguages().getDefault(); | ||
Imcms.getServices().getDocumentMapper().getDocument(-- current document's id --).getMeta().getEnabledLanguages(); | ||
* set language by creating new: | ||
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.getUser().getDocGetterCallback().setLanguage(new DocumentLanguage(String code, String name, String nativeName), boolean isDefaultLang); | ||
Imcms.getServices().getDocumentMapper().getDocument(---id---).setLanguage(---DocumentLanguage--); | ||
where ``code`` is language ISO-639-1 code. | ||
* @param name language name | ||
* @param nativeName language native name | ||
*/ | ||
public DocumentLanguage(String code, String name, String nativeName) { | ||
this.code = code; | ||
this.name = name; | ||
this.nativeName = nativeName; | ||
} | ||
* set user's language (not recommended): | ||
.. code-block:: java | ||
Imcms.getServices().getDocumentMapper().getDocument(---id---).getMeta().getEnabledLanguages(); | ||
Imcms.getServices().getDocumentMapper().getDocument(---id---).setLanguage(---DocumentLanguage--); | ||
Imcms.getUser().getDocGetterCallback().setLanguage(DocumentLanguage language, boolean isDefault); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,53 @@ | ||
Properties | ||
========== | ||
|
||
In this article: | ||
- `Introduction`_ | ||
- `Server properties`_ | ||
- `Properties in other files`_ | ||
|
||
------------ | ||
Introduction | ||
------------ | ||
|
||
In ImCMS we have convenient service for working with *.properties files - ``imcode.util.PropertyManager``. | ||
This class has own cache of properties files for quick access. | ||
Server properties | ||
""""""""""""""""" | ||
|
||
While starting application, ImCMS automatically read its root path and goes to ``WEB-INF/conf/server.properties`` to | ||
read server properties. Properties from this file can be accessed by next methods: | ||
.. code-block:: java | ||
PropertyManager.getServerConfProperty(String property); | ||
- read the value of ``property`` from server properties. | ||
|
||
.. code-block:: java | ||
PropertyManager.getServerConfProperties(); | ||
- returns server properties in ``Properties`` type for next use. | ||
|
||
Properties in other files | ||
""""""""""""""""""""""""" | ||
|
||
If you need to read some properties from another files, you may use next methods: | ||
.. code-block:: java | ||
PropertyManager.getPropertyFrom(String path, String property); | ||
- read the value of ``property`` from properties file by specified path. | ||
|
||
.. code-block:: java | ||
PropertyManager.getIntegerPropertyFrom(String path, String property); | ||
- read the Integer value of ``property`` from properties file by specified path. | ||
|
||
.. code-block:: java | ||
PropertyManager.getPropertiesFrom(String path); | ||
- returns properties which lies by specified path in ``Properties`` type for next use. |
Oops, something went wrong.