PHP Classes

File: docs/source/getting_started.rst

Recommend this page to a friend!
  Classes of Francesco Danti  >  ATK4 i18next PHP  >  docs/source/getting_started.rst  >  Download  
File: docs/source/getting_started.rst
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: ATK4 i18next PHP
Translate application texts like il8next-PHP
Author: By
Last change:
Date: 3 years ago
Size: 1,405 bytes


Class file image Download
.. _getting_started:

Getting started


.. code-block:: php

    $translator = new Translator();

Define root path for translations

.. code-block:: php


(optional) Define if filename has to be used has namespace

.. code-block:: php


(optional) Define namespaces priority

.. code-block:: php


Define primary and fallback language (name of the folders where library load files)

.. code-block:: php


Add additional language

.. code-block:: php


Usage examples

.. code-block:: php

    $result = $translator->_('definitionKey');
    $result = $translator->_('definitionKey', ['param1' => 'test']);
    $result = $translator->_('definitionKey', ['param1' => 'test'], 'context');
    $result = $translator->_('definitionKey', ['param1' => 'test'], 'context', 'specificLanguage');
    $result = $translator->_('namespace:definitionKey', ['param1' => 'test'], 'context', 'specificLanguage');

The TranslatorInterface

.. literalinclude:: ../../src/I18Next/TranslatorInterface.php
    :language: php
For more information send a message to info at phpclasses dot org.