Info Panel
Roll it!   ⇔
1 - Documantation
* Knowledge Base
  • Mvc
  • Application
  • Advanced
  • Operators
  • Api
* Origin Template
  • Customize
* Core Classes
* Classes

* all grey titles exists but not documented yet

Extract Translate

Type: core

Class: Trans

Platform: 2v

Function: extractTrans

Visibility: public

Parameter: extractTrans($text,$externalVar)

Description:
The most important function for using the multi language ability is this one. Combined loadTrans function with this function you can output the translated text to the end user.
- There are 2 formats that the translation file can be load from: php array or xml, done by loadTrans.
- This function will use the format that have been given in loadMethod.
Parameters:
(required) - string - $text - The text to be translated - Written in the default language (usually en).
(optional) - string|array - $externalVar - Containing the values that will effect the translation.
Return:
string - The translated text.
Callable from (extended classes):
application: controller,view
advanced: controller,view
operators: controller,view
api: controller,view
example: 1
We want to translate a sentence, so we firstly begin by loading the translated text with the function loadTrans, after that we can continue as follows. The translated text will be shown according to the current site language. If we set the page to be in "hebrew", the text will be accordingly.
How to call (example):
Code:
Possible outcome (example):
Output:
example: 2
Here we want to add the text a variable that can be changed in the code from time to time, so we don't have to translate the sentence many times in the translation file, once will do it just fine. So again, if we set the page to be in "hebrew", the text will be accordingly.
How to call (example):
Code:
Possible outcome (example):
Output:
example: 3
More complexd issue is the next one. We want to show: "month" if we have variable that equal 1 and we want to show:"months" if we have variable that let's say equal 8. It all have to be on the translation file - It is dependent on it. So again, if we set the page to be in "english" this time, the text will be accordingly.
How to call (example):
Code:
Possible outcome (example):
Output:
Info Panel
Roll it!   ⇔