Load Translate
Function: loadTrans
Visibility: public
Parameter: loadTrans($fileName)
Description:
To enable the ability to translate with the T/extractTrans function, we have to load the translation file first. The way to do it, is with this function. Usually all translation files will be located under: \text\translations\{language code}\ directory. Inside this directory we can locate the translator file in any language we choose according to it's directory.
- There are 2 formats that the translation file can be saved: php array or xml.
- This function will use the format that have been given in loadMethod.
- There are 2 formats that the translation file can be saved: php array or xml.
- This function will use the format that have been given in loadMethod.
Parameters:
(required) - string|array - $fileName - The name of the file we want to load, must be located at: \text\translations\language code.
Return:
array - The translation data - Contain all the translated text.
Callable from (extended classes):
application: controller,view
advanced: controller,view
operators: controller,view
api: controller,view
example: 1
Let's say that we want to load translation file, it must be located first in the designated directory mentioned above. The text that will be stored there must be in array named:
$translations
.
How to call (example):
Possible outcome (example):
Output:
example: 2
We can also translate one sentence in many forms. There are many languages that a word can reffer other words in a sentence be diffrent then the other. Like in english if we say that "the man have many wives" or "the man have one wife", there is a difference with the word wife/wives for referring =1 or >1. That can be achieved by adding the number of the "refer" to the array in form of a key. If we choose "2" the sentence that will be taken must be "2" or bigger then "2".
How to call (example):
Possible outcome (example):
Output: