$_lang
$_lang
Enables us to use content from words table of BW from within the platform PT structure.
Instantiate in the first lines of your template, then call the "get" method.
getFormatted(string $code) : string
Looks up (localized) texts in BW words table.
Newlines are replaced by HTML breaks, backslashes are stripped off. Takes a variable number of arguments as c-style formatted string.
string | $code | keyword for finding text, not allowed to be empty |
localized text, in case of no hit the word keycode, evtl with tr links
getRaw(string $code, array $replacements, string $language) : string
Look up texts in words table.
No newlines or slashes are replaced. Never add translation links.
string | $code | keyword for finding text, not allowed to be empty |
array | $replacements | strings to be inserted into the translation's %s placeholders |
string | $language | ShortCode of language, 2 to 4 letter |
localized text, in case of no hit the word keycode
getPurified(string $code, array $replacements, string $language) : string
Look up texts in words table.
Use purifier to add paragraphs and linkify. Never add translation links.
string | $code | keyword for finding text, not allowed to be empty |
array | $replacements | strings to be inserted into the translation's %s placeholders |
string | $language | ShortCode of language, 2 to 4 letter |
localized text, in case of no hit the word keycode
getFormattedInLang(string $code, $lang) : string
Looks up (localized) texts in BW words table.
Newlines are replaced by HTML breaks, backslashes are stripped off. Takes a variable number of arguments as c-style formatted string.
Second parametter is the language
string | $code | keyword for finding text, not allowed to be empty |
$lang |
localized text, in case of no hit the word keycode, evtl with tr links
MakeRevision( $Id, $TableName, $IdMemberParam, $DoneBy)
------------------------------------------------------------------------------ function : MakeRevision this is a copy of a function allready running in Function tools this is not the best place for it, please contact jeanyves if you feel like to change this MakeRevision this function save a copy of current value of record Id in table TableName for member IdMember with Done By reason @$Id : id of the record @$TableName : table where the revision is to be done @$IdMemberParam : the member who cause the revision, the current memebr will be use if this is not set @$DoneBy : a text to say why the update was done (this must be one of the value of the enum 'DoneByMember','DoneByOtherMember","DoneByVolunteer','DoneByAdmin','DoneByModerator')
$Id | ||
$TableName | ||
$IdMemberParam | ||
$DoneBy |
InsertInMTrad( $ss, $TableColumn, $IdRecord, $_IdMember, $_IdLanguage, $IdTrad)
InsertInFTrad function
This InsertInFTrad create a new translatable text in MemberTrad @$ss is for the content of the text @$TableColumn refers to the table and coilumn the trad is associated to @$IdRecord is the num of the record in this table @$_IdMember ; is the id of the member who own the record @$_IdLanguage @$IdTrad is probably useless (I don't remmber why I defined it)
Warning : as default language this function will use by priority : 1) the content of $_IdLanguage if it is set to something else than -1 2) the content of an optional $_POST[IdLanguage] if it is set 3) the content of the current $_SESSION['IdLanguage'] of the current membr if it set 4) The default language (0)
returns the id of the created trad
Improvment: if the value is empty then nothing is inserted but 0 is returned
$ss | ||
$TableColumn | ||
$IdRecord | ||
$_IdMember | ||
$_IdLanguage | ||
$IdTrad |
ReplaceInMTrad( $ss, $TableColumn, $IdRecord, $IdTrad, $IdOwner)
ReplaceInMTrad function
This ReplaceInMTrad replace or create translatable text in member Trad @$ss is for the content of the text @$TableColumn refers to the table and column the trad is associated to @$IdRecord is the num of the record in this table $IdTrad is the record in member_trads to replace they are several records with the smae IdTrad teh difference is thr language, if IdTrad is set to 0 a new record will be created, this is the usual way to insert records @$IdOwner ; is the id of the member who own the record, if set to 0 We Will use the current member
Warning : as default language this function will use:
$ss | ||
$TableColumn | ||
$IdRecord | ||
$IdTrad | ||
$IdOwner |
InsertInFTrad( $ss, $TableColumn, $IdRecord, $_IdMember, $_IdLanguage, $IdTrad)
InsertInfTrad function
This InsertInFTrad create a new translatable text in translations @$ss is for the content of the text @$TableColumn refers to the table and coilumn the trad is associated to @$IdRecord is the num of the record in this table @$_IdMember ; is the id of the member who own the record @$_IdLanguage @$IdTrad is probably useless (I don't remmber why I defined it)
Warning : as default language this function will use by priority : 1) the content of $_IdLanguage if it is set to something else than -1 2) the content of an optional $_POST[IdLanguage] if it is set 3) the content of the current $_SESSION['IdLanguage'] of the current membr if it set 4) The default language (0)
returns the id of the created trad
improvment if the text value is empty, nothing is inserte din the table, and 0 is retruned as an IdTrad
$ss | ||
$TableColumn | ||
$IdRecord | ||
$_IdMember | ||
$_IdLanguage | ||
$IdTrad |
ReplaceInFTrad( $ss, $TableColumn, $IdRecord, $IdTrad, $IdOwner)
ReplaceInFTrad function
This ReplaceInFTrad replace or create translatable text in translations @$ss is for the content of the text @$TableColumn refers to the table and column the trad is associated to @$IdRecord is the num of the record in this table $IdTrad is the record in translations to replace (unique for each IdLanguage) @$Owner ; is the id of the member who own the record
Warning : as default language this function will use by priority : 1) the content of $_IdLanguage if it is set to something else than -1 2) the content of an optional $_POST[IdLanguage] if it is set 3) the content of the current $_SESSION['IdLanguage'] of the current membr if it set 4) The default language (0)
$ss | ||
$TableColumn | ||
$IdRecord | ||
$IdTrad | ||
$IdOwner |
_text_with_tr(\LookedUpWord $word) : string
creates a string that contains the translated word and evtl a tr link.
\LookedUpWord | $word | an object of type LookedUpWord, containing all the stuff from DB lookup |
the string to be used in the webpage
_lookup(\unknown_type $code, $args, $lang, $get_raw) : \LookedUpWord
looks up a word keycode in the DB, and returns an object of type LookedUpWord.
If a translation in the intended language is not found, it uses the English version. If no English definition exists, the keycode itself is used.
\unknown_type | $code | the key code for the db lookup |
$args | ||
$lang | ||
$get_raw |
information that is created from the word lookup
_modified_sentence_from_row(\dbrow $row, array $args, boolean $get_raw) : string
Reads the (modified) translation sentence from a row in the database.
Modifications (if $get_raw is false):
\dbrow | $row | |
array | $args | |
boolean | $get_raw | true for raw string, false for modified string |
modified sentence from db
_lookup_row(string $code, string $lang, $extraWhere) : \dbrow
looks up only one row in the database
Looks up (localized) texts in BW words table according to provided language.
string | $code | keyword for finding text, not allowed to be empty |
string | $lang | 2-letter code for language |
$extraWhere |
an object representing one row in the database (?)