Files
ViciDialSVN/agc_2-X/trunk/docs/LANGUAGES_QXZ_notes.txt
T
mattf 681f050a36 Added Languages admin web screens
Added more error checking to agent logins
Fixed issues with alternate DB queriesin admin.php
Changed timecheck.pl script to not send out alerts for active=N servers

git-svn-id: svn://192.168.202.10@2215 3d104415-ff17-0410-8863-d5cf3c621b8a
2014-12-04 17:18:21 +00:00

80 lines
4.4 KiB
Plaintext

Notes on the non-English language translations(QXZ process) Started: 2014-11-18 Updated: 2014-12-04
Summary:
In the 2.10 branch, we started converting from a static build process for non-English languages of the agent and admin web interfaces, to a dynamic load-time process. This necessitated creating a new function in the agent and admin web interface functions.php files to facilitate the printing or echoing of text and image names within PHP. We call this function QXZ.
As of 2014-12-04, the administrative web interface was completed. To enable languages, you need to go to Admin -> System Settings in the admin.php web interface, then set "Enable Languages" to "1" and submit. Then go to your user modify page and set "Modify Languages" to "1" and submit. Now you will be able to go to Admin -> Languages and you can create new languages, copy existing languages, import languages and export languages.(The import and export processes use the existing <english>|<other-language>|| file format for UTF-8 text that is used for the language translations files currently in the codebase.)
The last two steps are: To create a flexible way of assigning languages to agents and/or user groups, and creating an efficient way of looking up the phrases to match the selected language on the fly as the dynamic agent and admin web pages are loaded by users.
Example PHP Code:
echo _QXZ("Closer In Group Choice %1s has been registered to user %2s",0,'',$closer_choice,$user)."\n";
The function call options in order are: "English text", "fixed legth", "l=left or r=right or blank for left", <list of up to 9 PHP variables>
The QXZ function allows for up to 9 defined and ordered variables to be placed in the output using a "Percent-sign, digit, lower-case-s" format (i.e. "%1s") where the digit is the place that the variable is defined at the end of the QXZ function call.
Utilities:
/usr/share/astguiclient/ADMIN_www_languages.pl
ADMIN_www_languages.pl - analyze all php scripts for QXZ functions and contents and insert in DB
This script is designed to scan all scripts in the agc and vicidial web directories and gather all of the QXZ phrases present, then insert them into the "www_phrases" database table. After that is done, those phrases can be populated into the "vicidial_language_phrases" database table when adding new Languages in the Administration Web Interface.
/usr/share/astguiclient/ADMIN_www_languages.pl --help
options:
[--help] = this help screen
[--debug] = verbose debug messages
[--debugX] = extra verbose debug messages
[--agc-only] = only parse the agc directory
[--vicidial-only] = only parse the vicidial directory
[--QXZlines] = print full lines that include QXZ functions
[--QXZvalues] = print only QXZ function values
[--QXZvaronly] = print only QXZ function values with PHP variables in them
[--QXZlengthonly] = print only QXZ function values that include a length spec
[--QXZplaceonly] = print only QXZ function values with placeholder variables in them
[--conffile=/path/from/root] = define astguiclient.conf config file to use
/usr/share/astguiclient/QXZanalyzer.pl --debug --QXZvalues --QXZvaronly --file=/srv/www/htdocs/agc/astguiclient.php
There is a utility stored in the /extras/ directory of the source tree called "QXZanalyzer.pl". This perl script can analyze the PHP scripts one at a time and print out various different types of output to help gather the phrases necessary for future translations as well as to help debug any issues with the PHP code itself
/usr/share/astguiclient/QXZanalyzer.pl --help
QXZanalyzer.pl - analyze php scripts for QXZ functions and contents
options:
[--help] = this help screen
[--debug] = verbose debug messages
[--QXZlines] = print full lines that include QXZ functions
[--QXZvalues] = print only QXZ function values
[--QXZvaronly] = print only QXZ function values with PHP variables in them
[--QXZlengthonly] = print only QXZ function values that include a length spec
[--QXZplaceonly] = print only QXZ function values with placeholder variables in them
[--file=/path/from/root] = define PHP file to analyze
Sample output:
ANALYSIS FINISHED!
File path: /srv/www/htdocs/agc/manager_send.php
Lines in file: 2256
QXZ line count: 130
QXZ count: 130
QXZ with length set: 101
QXZ with PHP vars: 101
QXZ with var place set: 101
QXZ with PHP vars inst: 149
QXZ with var place inst: 149