|
Class TChoiceFormat
TChoiceFormat class.
This component performs message/string choice translation. The translation
source is set in the TGlobalization module. The following example demonstrates a
simple 2 choice message translation.
<com:TChoiceFormat Value="1">[1] One Apple. |[2] Two Apples</com:TChoiceFormat>
The Choice has Value "1" (one), thus the translated string is "One
Apple". If the Value is "2", then it will show "Two Apples".
The message/string choices are separated by the pipe "|" followed by a set
notation of the form # [1,2] -- accepts values between 1 and 2,
inclusive. # (1,2) -- accepts values between 1 and 2, excluding 1 and
2. # {1,2,3,4} -- only values defined in the set are accepted. #
[-Inf,0) -- accepts value greater or equal to negative infinity and
strictly less than 0 Any non-empty combinations of the delimiters of square and
round brackets are acceptable.
The string choosen for display depends on the Value property. The
Value is evaluated for each set until the Value is found to belong to a
particular set.
Properties
- Value, float,
Gets or sets the Value that determines which string choice to display.
Since version 3.1.2 the following set notation is also possible.
# {n: n % 10 > 1 && n % 10 < 5} -- matches numbers like
2, 3, 4, 22, 23, 24
Where set is defined by the expression after n:. In particular, the
expression accepts the following mathematical/logical operators to form a set of
logical conditions on the value given by n: # < -- less
than. # <= -- less than equals. # > -- greater than. #
>= -- greater than equals. # == -- of equal value. #
% -- modulo, e.g., 1 % 10 equals 1, 11 % 10 equals 1. # - --
minus, negative. # + -- addition. # & -- conditional AND.
# && -- condition AND with short circuit. # | --
conditional OR. # || -- conditional OR with short circuit. # !
-- negation.
Additional round brackets can also be used to perform grouping.
-
TComponent
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TI18NControl
-
TTranslate
-
TChoiceFormat
Package: System\ I18N
Copyright:
Copyright © 2005-2014 PradoSoft
License:
http://www.pradosoft.com/license/
Author:
Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>
Version:
v1.0, last update on Fri Dec 24 21:38:49 EST 2004
Located at I18N/TChoiceFormat.php
Methods summary
public
float
|
#
getValue( )
Returns
float the numerical value.
|
public
|
#
setValue( float $value )
Sets the numerical choice value
Sets the numerical choice value
Parameters
- $value
float the choice value
|
protected
string
|
#
translateText( string $text, array $subs )
Display the choosen translated string. Overrides the parent method, also
calls parent's renderBody to translate.
Display the choosen translated string. Overrides the parent method, also
calls parent's renderBody to translate.
Parameters
- $text
string text for translation
- $subs
array list of substitutions
Returns
string translated text
Overrides
|
Methods inherited from TTranslate
getCatalogue(),
getKey(),
getParameter(),
getParameters(),
getText(),
getTrim(),
hasParameter(),
removeParameter(),
render(),
setCatalogue(),
setKey(),
setParameter(),
setText(),
setTrim()
|
Methods inherited from TControl
__construct(),
__get(),
addParsedObject(),
addToPostDataLoader(),
addedControl(),
applyStyleSheetSkin(),
autoBindProperty(),
autoDataBindProperties(),
bindProperty(),
broadcastEvent(),
bubbleEvent(),
clearChildState(),
clearControlState(),
clearNamingContainer(),
clearViewState(),
convertUniqueIdToClientId(),
createChildControls(),
createControlCollection(),
dataBind(),
dataBindChildren(),
dataBindProperties(),
ensureChildControls(),
findControl(),
findControlsByID(),
findControlsByType(),
focus(),
getAdapter(),
getAllowChildControls(),
getAttribute(),
getAttributes(),
getChildControlsCreated(),
getClientID(),
getControlStage(),
getControlState(),
getControls(),
getCustomData(),
getEnableTheming(),
getEnableViewState(),
getEnabled(),
getHasAdapter(),
getHasAttributes(),
getHasChildInitialized(),
getHasControls(),
getHasInitialized(),
getHasLoaded(),
getHasLoadedPostData(),
getHasPreRendered(),
getID(),
getIsSkinApplied(),
getNamingContainer(),
getPage(),
getParent(),
getRegisteredObject(),
getSkinID(),
getSourceTemplateControl(),
getTemplateControl(),
getUniqueID(),
getViewState(),
getVisible(),
hasAttribute(),
initRecursive(),
isDescendentOf(),
isObjectRegistered(),
loadRecursive(),
loadState(),
loadStateRecursive(),
onDataBinding(),
onInit(),
onLoad(),
onPreRender(),
onUnload(),
preRenderRecursive(),
raiseBubbleEvent(),
registerObject(),
removeAttribute(),
removedControl(),
renderChildren(),
renderControl(),
saveState(),
saveStateRecursive(),
setAdapter(),
setAttribute(),
setChildControlsCreated(),
setControlStage(),
setControlState(),
setCustomData(),
setEnableTheming(),
setEnableViewState(),
setEnabled(),
setID(),
setPage(),
setSkinID(),
setTemplateControl(),
setViewState(),
setVisible(),
trackViewState(),
traverseChildControls(),
unbindProperty(),
unloadRecursive(),
unregisterObject()
|
Methods inherited from TComponent
__call(),
__destruct(),
__isset(),
__set(),
__sleep(),
__unset(),
__wakeup(),
asa(),
attachBehavior(),
attachBehaviors(),
attachClassBehavior(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
clearBehaviors(),
createdOnTemplate(),
detachBehavior(),
detachBehaviors(),
detachClassBehavior(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
evaluateStatements(),
fxAttachClassBehavior(),
fxDetachClassBehavior(),
getAutoGlobalListen(),
getBehaviorsEnabled(),
getClassHierarchy(),
getEventHandlers(),
getListeningToGlobalEvents(),
getSubProperty(),
hasEvent(),
hasEventHandler(),
hasProperty(),
isa(),
listen(),
raiseEvent(),
setSubProperty(),
unlisten()
|
Constants inherited from TControl
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID
|
|