-
Notifications
You must be signed in to change notification settings - Fork 87
local dynamic label
local-dynamic-label dynamically creates a (glgui-label-wrapped) or (glgui-pixmap) widget and returns the index for it (which is what (glgui-label-wrapped) and (glgui-pixmap) return). This procedure is useful when some translations of text are in languages where characters are combined, and so the use of the FONT file cannot properly render these combined characters. Instead, these full strings must be listed in the STRINGS file.
This procedure uses (local-get-text) to get the translation of the string str. If this translation is provided, then a label is created using it. To use a texture instead, insert "[t]" in the localization csv file.
If (local-get-text) returns "[t]" then a texture will be used instead and a (glgui-pixmap) is created using this texture. The texture symbol is created by appending the language index and ".img" to the str and then converting it to a symbol. See the example below the list of parameters.
Parameter | Description |
---|---|
g | Graphical User Interface (GUI) for the new widget |
lx | Lower left corner along the x-axis in pixels |
ly | Lower left corner along the y-axis in pixels |
lw | Maximum width of the element in pixels |
lh | Maximum height of the element in pixels |
str | The string that is a key for the text to get in the current language. |
fnt | The font used to render the label string |
color | The widget text color |
alignl | Optional: The horizontal (and optionally vertical) alignment within the width and height. |
Example: The app below contains the following STRINGS and localization csv files. When the app is built, a texture is generated from each string in the STRINGS file, such that there will be hello3.img and bye3.img textures. When run, the csv file below is loaded and the index is set and then a dynamic label is created at position 10, 25. Since the localization file contains a "[t]" for the third language's translation of "hello", the app will look for texture hello3.img, and create a (glgui-pixmap) using this texture.
File STRINGS
Busra-R.ttf 14 'ជំរាបសួរ' hello3 Script=Khmer
Busra-R.ttf 14 'លា' bye3 Script=Khmer
File localization.csv
hello,Hi,Bonjour,[t]
bye,Goodbye,Au revoir,[t]
(local-load "localization.csv")
(local-index-set! 3)
(local-dynamic-label gui 10 25 100 30 "hello" fnt Blue)
-
- accelerometer
- alist
- audio
- audioaux
- base64
- btle-scan
- camera
- cdb
- cgi
- config
- csv
- curl
- digest
- dmtx
- download
- eventloop
- fcgi
- fft
- generalized-arrays
- gps
- graph
- gyro
- hidapi
- hpdf
- html
- httpsclient
- hybridapp
- json
- lmdb
- ln_core
- ln_glcore
- ln_glgui
- ln_store
- localization
- localization_gui
- localnotification
- magnetometer
- mdns
- mqtt
- mqtt-store
- multitouch
- oauth
- orientation
- p256ecdsa
- png
- portaudio
- pregexp
- pressure
- prime
- pushnotification
- redcap
- rsa
- rtaudio
- rupi
- rotation
- sanestring
- scheduler
- serial
- sets
- settings
- simplexnoise
- sqlite
- ssax
- syntax-case
- timestamp
- ttf
- uiform
- url
- uuid
- vibrate
- videoplayer
- watchdog
- website
- xml
- zip