Skip to content

Commit

Permalink
Docs little upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Maximchuk committed Dec 30, 2015
1 parent 80dd09e commit 2f30f76
Show file tree
Hide file tree
Showing 8 changed files with 283 additions and 244 deletions.
29 changes: 13 additions & 16 deletions docs/fundamental/advanced-configuration/language.rst
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);
50 changes: 50 additions & 0 deletions docs/fundamental/advanced-configuration/properties.rst
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.

0 comments on commit 2f30f76

Please sign in to comment.