Entertainment/youtube/movies

Monday, June 28, 2010

Certified, proven,guaranteed.work-at Home_Position!

You Can make $175,000 per Year working from your Home computer slaunch - Launch a parallel application under a SLURM job allocation. SYNOPSIS slaunch [options] [command args] DESCRIPTION NOTE: Support of slaunch is expected to be discontinued in the near future. Use of slaunch is not recommended. slaunch launches a parallel application (a job step in SLURM parlance) on the nodes, or subset of nodes, in a job allocation. A valid job allocation is a prerequisite of running slaunch. The ID of the job allocation may be passed to slaunch through either the --jobid command line parameter or the SLAUNCH_JOBID environment variable. The salloc and sbatch commands may be used to request a job allocation, and each of those commands automatically set the SLURM_JOB_ID environment variable, which is also understood by slaunch. Users should not set SLURM_JOB_ID on their own; use SLAUNCH_JOBID instead. OPTIONS -C, --overcommit Permit the allocation of more tasks to a node than there are available processors. Normally SLURM will only allow up to N tasks on a node with N processors, but this option will allow more than N tasks to be assigned to a node. -c, --cpus-per-task[=] Specify that each task requires ncpus number of CPUs. Useful for applications in which each task will launch multiple threads and can therefore benefit from there being free processors on the node. --comm-hostname[=] Specify the hostname or address to be used for PMI communications only (MPCIH2 communication bootstrapping mechanism). Defaults to short hostname of the node on which slaunch is running. --core[=] Adjust corefile format for parallel job. If possible, slaunch will set up the environment for the job such that a corefile format other than full core dumps is enabled. If run with type = "list", slaunch will print a list of supported corefile format types to stdout and exit. --cpu_bind=[{quiet,verbose},]type Bind tasks to CPUs. Used only when the task/affinity or task/numa plugin is enabled. NOTE: To have SLURM always report on the selected CPU binding for all commands executed in a shell, you can enable verbose mode by setting the SLURM_CPU_BIND environment variable value to "verbose". Supported options include: q[uiet], quietly bind before task runs (default) v[erbose], verbosely report binding before task runs no[ne] don't bind tasks to CPUs (default) rank bind by task rank map_cpu: bind by mapping CPU IDs to tasks as specified where is ,,.... CPU IDs are interpreted as decimal values unless they are preceded with '0x' in which case they interpreted as hexadecimal values. mask_cpu: bind by setting CPU masks on tasks as specified where is ,,.... CPU masks are always interpreted as hexadecimal values but can be preceded with an optional '0x'. -D, --workdir[=] Set the working directory of the tasks to directory before execution. The default task working directory is slaunch's working directory. -d, --slurmd-debug[=] Specify a debug level for slurmd(8). level may be an integer value between 0 [quiet, only errors are displayed] and 4 [verbose operation]. The slurmd debug information is copied onto the stderr of the job. By default only errors are displayed. -E, --task-error[=] Instruct SLURM to connect each task's standard error directly to the file name specified in the "filename pattern". See the --task-input option for filename specification options. -e, --slaunch-error[=] Instruct SLURM to connect slaunch's standard error directly to the file name specified in the "filename pattern". See the --slaunch-input option for filename specification options. --epilog[=] slaunch will run executable just after the job step completes. The command line arguments for executable will be the command and arguments of the job step. If executable is "none", then no epilog will be run. This parameter overrides the SrunEpilog parameter in slurm.conf. -F, --task-layout-file[=] Request a specific task layout. This option is much like the --task-layout-byname option, except that instead of a nodelist you supply the name of a file. The file contains a nodelist that may span multiple lines of the file. NOTE: This option implicitly sets the task distribution method to "arbitrary". Some network switch layers do not permit arbitrary task layout. --gid[=] If slaunch is run as root, and the --gid option is used, submit the job with group's group access permissions. group may be the group name or the numerical group ID. -h, --help Display help information and exit. -I, --task-input[=] Instruct SLURM to connect each task's standard input directly to the file name specified in the "filename pattern". By default, the standard IO streams of all tasks are received and transmitted over the network to commands like slaunch and sattach. These options disable the networked standard IO streams and instead connect the standard IO streams of the tasks directly to files on the local node of each task (although the file may, of course, be located on a networked filesystem). Whether or not the tasks share a file depends on whether or not the file lives on a local filesystem or a shared network filesytem, and on whether or not the filename pattern expands to the same file name for each task. The filename pattern may contain one or more replacement symbols, which are a percent sign "%" followed by a letter (e.g. %t). Supported replacement symbols are: %J Job allocation number and job step number in the form "jobid.stepid". For instance, "128.0". %j Job allocation number. %s Job step number. %N Node name. (Will result in a separate file per node.) %n Relative node index number within the job step. All nodes used by the job step will be number sequentially starting at zero. (Will result in a separate file per node.) %t Task rank number. (Will result in a separate file per task.) -i, --slaunch-input[=] Change slaunch's standard input to be a file of name "filename pattern". These options are similar to using shell IO redirection capabilities, but with the additional ability to replace certain symbols in the filename with useful SLURM information. Symbols are listed below. By default, slaunch broadcasts its standard input over the network to the standard input of all tasks. Likewise, standard output and standard error from all tasks are collected over the network by slaunch and printed on its standard output or standard error, respectively. If you want to see traffic from fewer tasks, see the --slaunch-[input|output|error]-filter options. Supported replacement symbols are: %J Job allocation number and job step number in the form "jobid.stepid". For instance, "128.0". %j Job allocation number. %s Job step number. -J, --name[=] Set the name of the job step. By default, the job step's name will be the name of the executable which slaunch is launching. --jobid= The job allocation under which the parallel application should be launched. If slaunch is running under salloc or a batch script, slaunch can automatically determint the jobid from the SLURM_JOB_ID environment variable. Otherwise, you will need to tell slaunch which job allocation to use. -K, --kill-on-bad-exit Terminate the job step if any task exits with a non-zero exit code. By default slaunch will not terminate a job step because of a task with a non-zero exit code. -L, --nodelist-byid[=] Request a specific set of nodes in a job alloction on which to run the tasks of the job step. The list may be specified as a comma-separated list relative node indices in the job allocation (e.g., "0,2-5,-2,8"). Duplicate indices are permitted, but are ignored. The order of the node indices in the list is not important; the node indices will be sorted my SLURM. -l, --label Prepend each line of task standard output or standard error with the task number of its origin. -m, --distribution= (block|cyclic|hostfile|plane=) Specify an alternate distribution method for remote processes. block The block method of distribution will allocate processes in-order to the cpus on a node. If the number of processes exceeds the number of cpus on all of the nodes in the allocation then all nodes will be utilized. For example, consider an allocation of three nodes each with two cpus. A four-process block distribution request will distribute those processes to the nodes with processes one and two on the first node, process three on the second node, and process four on the third node. Block distribution is the default behavior if the number of tasks exceeds the number of nodes requested. cyclic The cyclic method distributes processes in a round-robin fashion across the allocated nodes. That is, process one will be allocated to the first node, process two to the second, and so on. This is the default behavior if the number of tasks is no larger than the number of nodes requested. plane The tasks are distributed in blocks of a specified size. The options include a number representing the size of the task block. This is followed by an optional specification of the task distribution scheme within a block of tasks and between the blocks of tasks. For more details (including examples and diagrams), please see http://www.llnl.gov/linux/slurm/mc_support.html and http://www.llnl.gov/linux/slurm/dist_plane.html. hostfile The hostfile method of distribution will allocate processes in-order as listed in file designated by the environment variable SLURM_HOSTFILE. If this variable is listed it will over ride any other method specified. --mem_bind=[{quiet,verbose},]type Bind tasks to memory. Used only when task/affinity plugin is enabled and the NUMA memory functions are available Note that the resolution of CPU and memory binding may differ on some architectures. For example, CPU binding may be performed at the level of the cores within a processor while memory binding will be performed at the level of nodes, where the definition of "nodes" may differ from system to system. The use of any type other than "none" or "local" is not recommended. If you want greater control, try running a simple test code with the options "--cpu_bind=verbose,none --mem_bind=verbose,none" to determine the specific configuration. Note: To have SLURM always report on the selected memory binding for all commands executed in a shell, you can enable verbose mode by setting the SLURM_MEM_BIND environment variable value to "verbose". Supported options include: q[uiet], quietly bind before task runs (default) v[erbose], verbosely report binding before task runs no[ne] don't bind tasks to memory (default) rank bind by task rank (not recommended) local Use memory local to the processor in use map_mem: bind by mapping a node's memory to tasks as specified where is ,,.... CPU IDs are interpreted as decimal values unless they are preceded with '0x' in which case they interpreted as hexadecimal values (not recommended) mask_mem: bind by setting memory masks on tasks as specified where is ,,.... memory masks are always interpreted as hexadecimal values but can be preceded with an optional '0x' (not recommended) --mpi[=] Identify the type of MPI to be used. If run with mpi_type = "list", slaunch will print a list of supported MPI types to stdout and exit. --multi-prog This option allows one to launch tasks with different executables within the same job step. When this option is present, slaunch no long accepts the name of an executable "command" on the command line, instead it accepts the name of a file. This file specifies which executables and command line parameters should be used by each task in the job step. See the section MULTIPLE PROGRAMS FILE below for an explanation of the multiple program file syntax. -N, --nodes[=] Specify the number of nodes to be used by this job step. By default, slaunch will use all of the nodes in the specified job allocation. -n, --tasks[=] Specify the number of processes to launch. The default is one process per node. --network[=] (NOTE: this option is currently only of use on AIX systems.) Specify the communication protocol to be used. The interpretation of type is system dependent. For AIX systems with an IBM Federation switch, the following comma-separated and case insensitive options are recongnized: IP (the default is user-space), SN_ALL, SN_SINGLE, BULK_XFER and adapter names. For more information, on IBM systems see poe documenation on the environment variables MP_EUIDEVICE and MP_USE_BULK_XFER. -O, --task-output[=] Instruct SLURM to connect each task's standard output directly to the file name specified in the "filename pattern". See the --task-input option for filename specification options. -o, --slaunch-output[=] Instruct SLURM to connect slaunch's standard output directly to the file name specified in the "filename pattern". See the --slaunch-input option for filename specification options. --propagate[=rlimits] Allows users to specify which of the modifiable (soft) resource limits to propagate to the compute nodes and apply to their jobs. If rlimits is not specified, then all resource limits will be propagated. The following rlimit names are supported by Slurm (although some options may not be supported on some systems): AS The maximum address space for a processes CORE The maximum size of core file CPU The maximum amount of CPU time DATA The maximum size of a process's data segment FSIZE The maximum size of files created MEMLOCK The maximum size that may be locked into memory NOFILE The maximum number of open files NPROC The maximum number of processes available RSS The maximum resident set size STACK The maximum stack size --prolog[=] slaunch will run executable just before launching the job step. The command line arguments for executable will be the command and arguments of the job step. If executable is "none", then no prolog will be run. This parameter overrides the SrunProlog parameter in slurm.conf. -q, --quiet Suppress informational messages from slaunch. Errors will still be displayed. -r, --relative[=] Specify the first node in the allocation on which this job step will be launched. Counting starts at zero, thus the first node in the job allocation is node 0. The option to --relative may also be a negative number. -1 is the last node in the allocation, -2 is the next to last node, etc. By default, the controller will select the starting node (assuming that there are no other nodelist or task layout options that specify specific nodes). --slaunch-input-filter[=] --slaunch-output-filter[=] --slaunch-error-filter[=] Only transmit standard input to a single task, or print the standard output or standard error from a single task. These options perform the filtering locally in slaunch. All tasks are still capable of sending or receiving standard IO over the network, so the "sattach" command can still access the standard IO streams of the other tasks. (NOTE: for -output and -error, the streams from all tasks WILL be transmitted to slaunch, but it will only print the streams for the selected task. If your tasks print a great deal of data to standard output or error, this can be performance limiting.) -T, --task-layout-byid[=] Request a specific task layout using node indices within the job allocation. The node index list can contain duplicate indices, and the indices may appear in any order. The order of indices in the nodelist IS significant. Each node index in the list represents one task, with the Nth node index in the list designating on which node the Nth task should be launched. For example, given an allocation of nodes "linux[0-15]" and a node index list "4,-1,1-3" task 0 will run on "linux4", task 1 will run on "linux15", task 2 on "linux1", task 3 on "linux2", and task 4 on "linux3". NOTE: This option implicitly sets the task distribution method to "arbitrary". Some network switch layers do not permit arbitrary task layout. --task-epilog[=] The slurmd daemon will run executable just after each task terminates. This will be before after any TaskEpilog parameter in slurm.conf is executed. This is meant to be a very short-lived program. If it fails to terminate within a few seconds, it will be killed along with any descendant processes. --task-prolog[=] The slurmd daemon will run executable just before launching each task. This will be executed after any TaskProlog parameter in slurm.conf is executed. Besides the normal environment variables, this has SLURM_TASK_PID available to identify the process ID of the task being started. Standard output from this program of the form "export NAME=value" will be used to set environment variables for the task being spawned. -u, --unbuffered Do not line buffer standard output or standard error from remote tasks. This option cannot be used with --label. --uid[=] Attempt to submit and/or run a job as user instead of the invoking user id. The invoking user's credentials will be used to check access permissions for the target partition. User root may use this option to run jobs as a normal user in a RootOnly partition for example. If run as root, slaunch will drop its permissions to the uid specified after node allocation is successful. user may be the user name or numerical user ID. --usage Display brief usage message and exit. -V, --version Display version information and exit. -v, --verbose Increase the verbosity of slaunch's informational messages. Multiple -v's will further increase slaunch's verbosity. -W, --wait[=] slaunch will wait the specified number of seconds after the first tasks exits before killing all tasks in the job step. If the value is 0, slaunch will wait indefinitely for all tasks to exit. The default value is give by the WaitTime parameter in the slurm configuration file (see slurm.conf(5)). The --wait option can be used to insure that a job step terminates in a timely fashion in the event that one or more tasks terminate prematurely. -w, --nodelist-byname[=] Request a specific list of node names. The list may be specified as a comma-separated list of node names, or a range of node names (e.g. mynode[1-5,7,...]). Duplicate node names are not permitted in the list. The order of the node names in the list is not important; the node names will be sorted my SLURM. -Y, --task-layout-byname[=] Request a specific task layout. The nodelist can contain duplicate node names, and node names may appear in any order. The order of node names in the nodelist IS significant. Each node name in the nodes list represents one task, with the Nth node name in the nodelist designating on which node the Nth task should be launched. For example, a nodelist of mynode[4,3,1-2,4] means that tasks 0 and 4 will run on mynode4, task 1 will run on mynode3, task 2 will run on mynode1, and task 3 will run on mynode2. NOTE: This option implicitly sets the task distribution method to "arbitrary". Some network switch layers do not permit arbitrary task layout. INPUT ENVIRONMENT VARIABLES Some slaunch options may be set via environment variables. These environment variables, along with their corresponding options, are listed below. Note: Command line options will always override environment variables settings. SLAUNCH_COMM_HOSTNAME Same as --comm-hostname. SLAUNCH_CORE_FORMAT Same as --core. SLAUNCH_CPU_BIND Same as --cpu_bind. SLAUNCH_DEBUG Same as -v or --verbose. SLAUNCH_DISTRIBUTION Same as -m or --distribution. SLAUNCH_EPILOG Same as --epilog=executable. SLAUNCH_JOBID Same as --jobid. SLAUNCH_KILL_BAD_EXIT Same as -K or --kill-on-bad-exit. SLAUNCH_LABELIO Same as -l or --label. SLAUNCH_MEM_BIND Same as --mem_bind. SLAUNCH_MPI_TYPE Same as --mpi. SLAUNCH_OVERCOMMIT Same as -C or --overcomit. SLAUNCH_PROLOG Same as --prolog=executable. SLAUNCH_TASK_EPILOG Same as --task-epilog=executable. SLAUNCH_TASK_PROLOG Same as --task-prolog=executable. SLAUNCH_WAIT Same as -W or --wait. SLURMD_DEBUG Same as -d or --slurmd-debug OUTPUT ENVIRONMENT VARIABLES slaunch will set the following environment variables which will appear in the environments of all tasks in the job step. Since slaunch sets these variables itself, they will also be available to --prolog and --epilog scripts. (Notice that the "backwards compatibility" environment variables clobber some of the variables that were set by salloc or sbatch at job allocation time. The newer SLURM_JOB_* and SLURM_STEP_* names do not conflict, so any task in any job step can easily determine the parameters of the job allocation.) SLURM_STEP_ID (and SLURM_STEPID for backwards compatibility) The ID of the job step within the job allocation. SLURM_STEP_NODELIST The list of nodes in the job step. SLURM_STEP_NUM_NODES (and SLURM_NNODES for backwards compatibility) The number of nodes used by the job step. SLURM_STEP_NUM_TASKS (and SLURM_NPROCS for backwards compatibility) The number of tasks in the job step. SLURM_STEP_TASKS_PER_NODE (and SLURM_TASKS_PER_NODE for backwards compatibility) The number of tasks on each node in the job step. SLURM_STEP_LAUNCHER_HOSTNAME (and SLURM_SRUN_COMM_HOST for backwards compatibility) SLURM_STEP_LAUNCHER_PORT (and SLURM_SRUN_COMM_PORT for backwards compatibility) Additionally, SLURM daemons will ensure that the the following variables are set in the environments of all tasks in the job step. Many of the following variables will have different values in each task's environment. (These variables are not available to the slaunch --prolog and --epilog scripts.) SLURM_NODEID Node ID relative to other nodes in the job step. Counting begins at zero. SLURM_PROCID Task ID relative to the other tasks in the job step. Counting begins at zero. SLURM_LOCALID Task ID relative to the other tasks on the same node which belong to the same job step. Counting begins at zero. SLURMD_NODENAME The SLURM NodeName for the node on which the task is running. Depending on how your system administrator has configured SLURM, the NodeName for a node may not be the same as the node's hostname. When you use commands such as sinfo and squeue, or look at environment variables such as SLURM_JOB_NODELIST and SLURM_STEP_NODELIST, you are seeing SLURM NodeNames. MULTIPLE PROGRAMS FILE Comments in the configuration file must have a "#" in collumn one. The configuration file contains the following fields separated by white space: Task rank One or more task ranks to use this configuration. Multiple values may be comma separated. Ranges may be indicated with two numbers separated with a '-'. To indicate all tasks, specify a rank of '*' (in which case you probably should not be using this option). Executable The name of the program to execute. May be fully qualified pathname if desired. Arguments Program arguments. The expression "%t" will be replaced with the task's number. The expression "%o" will be replaced with the task's offset within this range (e.g. a configured task rank value of "1-5" would have offset values of "0-4"). Single quotes may be used to avoid having the enclosed values interpretted. This field is optional. For example: ################################################################### # srun multiple program configuration file # # srun -n8 -l --multi-prog silly.conf ################################################################### 4-6 hostname 1,7 echo task:%t 0,2-3 echo offset:%o $ srun -n8 -l --multi-prog silly.conf 0: offset:0 1: task:1 2: offset:1 3: offset:2 4: linux15.llnl.gov 5: linux16.llnl.gov 6: linux17.llnl.gov 7: task:7 EXAMPLES To launch a job step (parallel program) in an existing job allocation: slaunch --jobid 66777 -N2 -n8 myprogram To grab an allocation of nodes and launch a parallel application on one command line (See the salloc man page for more examples): salloc -N5 slaunch -n10 myprogram

You Can make $175,000 per Year working from your Home computer

&+)angelaeel.com/grd.php?r-Nzg3MDQxYyE0NXBhN3A3OHBiITE4MmEhNDAwIXBhZDAxfGdtIWNiaW50ZXJuZXRmaW5kZXJnbWZyaiE3ZGF0NnQxYyE=

Gain Access To Work-At-Home Jobs With Compaines paying As Much As $75 An Hour

Discover-How You could Easliy $1000s/day from the comfort of your_home

You May Hired,&Immediate Placement

No-Experiance_Necessary
No-set_Schedule - You Choose Your Hours
No-Degree_Required

Click-Below to Start_Earning_Money_Now

&+)angelaeel.com/grd.php?r-Nzg3MDQxYyE0NXBhN3A3OHBiITE4MmEhNDAwIXBhZDAxfGdtIWNiaW50ZXJuZXRmaW5kZXJnbWZyaiE3ZGF0NnQxYyE=



----------------------
Unsubscribe_FromSponsor:
&+)angelaeel.com/grd.php?uu-Nzg3MDQxYyE0NXBhN3A3OHBiITE4MmEhNDAwIXBhZDAxfGdtIWNiaW50ZXJuZXRmaW5kZXJnbWZyaiE3ZGF0NnQxYyE=
orWrite to 11136 Ferragamo Ct. Las Vegas NV 89141


Unsubscribe-FromMailing:
&+)angelaeel.com/grd.php?ui-Nzg3MDQxYyE0NXBhN3A3OHBiITE4MmEhNDAwIXBhZDAxfGdtIWNiaW50ZXJuZXRmaW5kZXJnbWZyaiE3ZGF0NnQxYyE=

write to-p-o_box Scientific_show pobox 225 3066Zelda RD_Montgomery AL36106US

Sunday, June 27, 2010

ALERT: We_Cant Send_Dell_XPS-Package.Go Inside and correct street_address!

ALERT: We_Cant Send_Dell_XPS-Package.Go Inside and correct street_address!ALERT: We_Cant Send_Dell_XPS-Package.Go Inside and correct street_address! xmultiplication Filters m echo "$recno. $na $ti $remark" >> /tmp/input0.$$ 6) Your current working directory Quotes in Shell Scripts m 11) Show computer cpu information like processor type, speed etc Variables in Linux m Linux Shell Script Tutorial utility # Q.2.Write Script to find out biggest number from given three nos. Nos are supplies as command line message : - Q.4. Write Script, using case statement to perform basic math operation as clear help_ani $ ani -n Lassie -a 4 2) Your current shell $ ./q4 20 / 3, Also check for sufficient command line arguments or $1 does not contains "*" symbol add it to $1, otherwise show message "Symbol is not required". For e.g. isdef=0 echo " -w weight of animal" Answer: See Q14 shell Script http://www.freeos.com/guides/lsst/maspc.htm (16 of 17) [17/08/2001 17.42.32]corner of the screen , while user can do his/her normal job at $ prompt. 5) Your current path setting # read ti -e { editor } start this { editor } if installed fi Where options work as This command is used to check valid command line argument passed to script. Usually used in while loop. # help_ani() To print help read na $ ani -n Lassie -a 4 -s Female -w 20Kg -c Mammal # # After given database file name and after giving appointment title press CTRL+C, Here we have already Here $1 is /bin, it should check whether "*" symbol is present or not if not it should print Required i.e. Shell Programming getopts command and productive (As you see from above shell script exercise), you should continue to read more advance Answer: See Q18 shell Script. #Start main procedure echo -n "Any Remark :" above script in editor and modify it so that at the end it will look like as follows Q.15. Write script called sayHello, put this script into your startup file called .bash_profile, the script Note: Create function for all action for e.g. To show date/time on screen create function argument. Print error if sufficient arguments are not supplied. $./testsign1 # Call our user define function : Take_input1 10) Show mouse settings Take_input1() # + addition rm -f /tmp/input0.$$ w) weight="$OPTARG";; menu-item is as follows # Q.10.How to perform real number calculation in shell script and store result to Answer: See Q16 shell Script # temporary file and then exit with exit status 1. Now check /tmp directory as follows present, if no name of directory given assumes current 4) Your operating system type Syntax: getopts {optsring} {variable1} calculate the 5.12 + 2.5 l Calendar To see current calendar Calendar must be shown using infobox of dialog utility Linux commands related with process m $ ls /tmp/input* # # Usage: ani -n -a -s -w -d If we called this script Q12 then after giving , recognized; if a letter is followed by a colon, the option is expected to have an argument, which should a) age="$OPTARG";; l After given database file name and after adding at least one appointment record to temporary file press { 7) Show Currently logged number of users options for ani script # Why to trap signal, version 1 # Linux Shell Scripting Tutorial # Take_input1 exit 1 © 1998-2000 FreeOS.com (I) Pvt. Ltd. All rights reserved. Here no space between option and their value. using trap command Good Afternoon Now problem is that while running this script, if you press CTRL + C, your shell script gets terminated and to database file and then loop will be terminated. You can view your database file by using cat command. show_datetime(). Date/time To see current date time Date and time must be shown using infobox of dialog while : # read isnext del_file() be separated from it by white space. Each time it is invoked, getopts places the next option in the shell # Set trap to for CTRL+C interrupt, Rules for Naming variable name m variable variable1, When an option requires an argument, getopts places that argument into the variable echo "Options: These are optional argument" Kernel m Redirection of Standard output/input while getopts n:a:s:w:d opt First try to write this shell script, as exercise, if any problem or for sample answer to this Shell script open Q.3.Write script to print nos as 5,4,3,2,1 using while loop. esac rm -f /tmp/input0.$$ / division -m start mc (midnight commander shell) , if installed Linux Shell Script Tutorial age="2 Months" # while deleting file to user. # signal is trapped to delete temporary file , version 2 # Set a infinite loop $ Q13 5 5 myf , Here print contains of 'myf' file from line number 5 to next 5 line of that file. Q.1. How to write shell script that will add two nos, which are supplied as command line argument, and if Introduction # if [ $# -lt 1 ]; then See because of getopts, we can pass command line argument in different style. Following are invalid temporary file are left in /tmp directory. For e.g. try as follows appointment record, if yes then next record is added , otherwise all records are copied from temporary file # recno=`expr $recno + 1` read na { How to print or access value of UDV (User defined variables) m $ ls /tmp/input* the shell script file supplied with this tutorial. else # # $ ani -n Lassie -s Female -w 20Kg -a 4 answer is yes then delete the file , report errors if any captured this CTRL + C signal (interrupt), so first our function del_file() is called, in which it gives if [ $isnext = n -o $isnext = N ]; then Q14 -c -d -m -e cat /tmp/input0.$$ >> $filename should run as soon as you logon to system, and it print any one of the following message in infobox using Process # # Set a infinite loop $ ani -w 20Kg -s Female -n Lassie -a 4 } Q.19. Write shell script to show various system configuration like echo "$recno. $na $ti $remark" >> /tmp/input0.$$ 12) Show memory information -s sex of animal Q.17. Write script to implement background process that will continually print current time in upper right Answer: See Q3 shell Script. To catch this signal in above script, put trap statement before calling Take_input1 function as trap echo -n "Enter your database file name : " read ans Answer: See Q13 shell Script # $ ani -nLassie-a4-sFemal-w20Kg Our script needs to detect when such signal (event) occurs, To achieve this we have to first detect Signal topics and books. If you have any suggestion or new ideas or problem with this tutorial, please feel free to user whether he/she wants to delete selected file, if read filename Exit To Exit this shell script Exit/Stops the menu driven program i.e. this script Good Morning #if no argument echo " -s sex of animal " echo "Usage: $0 -n -a -s -w -d" # Call our user define function : Take_input1 $ chmod +x testsign1 Common Linux Command Introduction m 1) Currently logged user and his logname n) na="$OPTARG";; Q.6.Write script to print given number in reverse order, for eg. If no is 123 it must print as 321. /bin/*, and if symbol present then Symbol is not required must be printed. Test your script as $ ani -a 2 The name of script must be 'q4' which works as follows Pipes m $ vi testsign1 l done Shell m clear http://www.freeos.com/guides/lsst/maspc.htm (13 of 17) [17/08/2001 17.42.32] -a age of animal echo -n "Enter your database file name : " Delete To delete selected file contact me. Save it and run as { # cat /tmp/input0.$$ >> $filename Answer: See Q11 shell Script. recno=0 found, file is created, after that it open one temporary file in /tmp directory, and puts today's date in that Redirectors m echo "Sorry, $filename does not exit, Creating $filename database" Here -c is not one of the options. fi 9 kill (cannot be caught) return # terminate loop Q.7.Write script to print given numbers sum of all digit, For eg. If no is 123 it's sum of all digit will be Linux Shell Script Tutorial do echo "Appointment Note keeper Application database file" > $filename Syntax: trap {commands} {signal number list} del_file 2 ., Here trap command called del_file() when 2 number interrupt ( i.e.CTRL+C ) occurs. Open #Set default value for variable fi } giving command as follows Q.5.Write Script to see current date, time, username, and current directory correct its written to temporary file, After that script ask user , whether he/she wants add next Q.18. Write shell script to implement menus using dialog utility. Menu-items and action according to select do while : Q.9.How to calculate 5.12 + 2.5 real number calculation at $ prompt in Shell ? $ Q12 /bin Q.11.Write script to determine whether given file exist or not, file name is supplied as command line read remark echo " their values are not taken)" echo -n "Add next appointment (y/n)?" $ ani -a 4 -s Female -n Lassie -w 20Kg $ chmod +x ani dialog utility, if installed in your system, If dialog utility is not installed then use echo statement to print case "$opt" in - subtraction # 1+2+3 = 6. follows echo -n "Any Remark :" How to Run Shell Scripts m argument called this script Q14, # $ ani -nLassie -a4 -sFemal -w20Kg $ ani -w 20Kg -s Female getopts is used by shell to parse command line argument. optstring contains the option letters to be More examples of Shell Script (Exercise for You :-) s) sex="$OPTARG";; echo "Animal Name: $na, Age: $age, Sex: $sex, Weight: $weight (user define mode)" read filename OPTARG. On errors getopts diagnostic messages are printed when illegal options or missing option # echo "Sorry, $filename does not exit, Creating $filename database" # fi \?) help_ani;; echo -n "Appointment Title:" then return # terminate loop http://www.freeos.com/guides/lsst/maspc.htm (11 of 17) [17/08/2001 17.42.32]file. Then one infinite loop begins, which ask appointment title, time and remark, if this information is How to write shell script m fi http://www.freeos.com/guides/lsst/maspc.htm (17 of 17) [17/08/2001 17.42.32] { Q.12.Write script to determine whether given command line argument ($1) contains "*" symbol or not, if Why Process required m Answer: Use Linux's bc command echo "* * * CTRL + C Trap Occurs (removing temporary file)* * *" message as "* * * CTRL + C Trap Occurs (removing temporary file)* * * " and then it remove our colors like red, brown etc using echo command. $ ani -n Lassie -a 4 -s Female -w 20Kg 3 quit Menu-Item Purpose Action for Menu-Item echo -n "Is data okay (y/n) ?" fi help_ani() # $ Q12 /bin Answer: See Q10 shell Script. Answer: See Q12 shell Script Now Shell will report no such temporary file exit. How to use Shell m Answer: See Q17 shell Script. Answer: See Q5 shell Script. Now save it run the program as Options: These are optional argument their values are not taken) echo "Animal Name: $na, Age: $age, Sex: $sex, Weight: $weight (demo mode)" age=3 l Take_input1 -d demo values (if any of the above options are used ani -n -a -s -w -d echo " -a age of animal" $ ani -n Lassie do Linux Shell Script Tutorial Take_input1() echo -n "Is data okay (y/n) ?" It first ask you main database file where all appointment of that day is stored, if no such database file That's all!, Thanks for reading, This tutorial ends here, but Linux programming environment is big, rich First ask user name of directory where all files are # When occurs it first it calls del_file() and then exit let the user select the file, then ask the confirmation to echo "Appointment Note keeper Application database file" > $filename third variable , lets say a=5.66, b=8.67, c=a+b? $ ./testsign1 -c clear the screen -n name of animal 13) Show hard disk information like size of hard-disk, cache memory, model etc http://www.freeos.com/guides/lsst/maspc.htm (12 of 17) [17/08/2001 17.42.32] echo -n "Appointment Title:" read ti Linux Shell Script Tutorial Answer: See Q2 shell Script. done sex=Male weight=20kg Linux Shell Script Tutorial 0 shell exit read isnext if [ ! -f $filename ]; then this two nos are not given show error and its usage na="Pluto Dog" rm -f /tmp/input0.$$ 2 interrupt (CTRL+C) 3) Your home directory My e-mail is gite-vivek@usa.net. echo "Data entry start data: `date`" >/tmp/input0.$$ Q.13. Write script to print contains of file from given line number to next given number of lines. For e.g. If done http://www.freeos.com/guides/lsst/maspc.htm (14 of 17) [17/08/2001 17.42.32]if [ $isdef -eq 0 ] if [ $ans = y -o $ans = Y ]; then $ mcedit testsign1 Answer: Use command as , $ echo 5.12 + 2.5 | bc , here we are giving echo commands output to bc to 14) File system (Mounted) echo " -d demo values (if any of the above options are used " Written by Vivek G Gite fi recno=0 read remark Q.16. How to write script, that will print, Message "Hello World" , in Bold and Blink effect, and in different script called ani which has syntax as Q.14. Write script to implement getopts statement, your script should understand following command line sex=Male echo "Appointment Note keeper Application for Linux" Answer: See Q19 shell Script. echo -n "Appoint time :" echo " -n name of animal" CTRL+C, Our script get terminated, and it left temporary file in /tmp directory, you can check this by } if [ $isnext = n -o $isnext = N ]; then we called this script as Q13 and run as $ cat > ani Signal Number When occurs Linux Shell Script Tutorial 9) Show all available shells arguments are encountered. If an illegal option is seen, getopts places ? into variable1. For e.g. We have Answer: See Q15 shell Script read ans # fi http://www.freeos.com/guides/lsst/maspc.htm (15 of 17) [17/08/2001 17.42.32]Answer: See Q6 shell Script. Linux Shell Scripting Tutorial Ver. 1.0 Save it and run as follows -d show list of files in current working directory How to define User defined variables m 1 hangup argument, also check for sufficient number of command line argument d) isdef=1;; Q.8.How to perform real number (number with decimal point) calculation in Linux $ ./testsign1 I N D E X trap del_file 2 if [ ! -f $filename ]; then echo "Appointment Note keeper Application for Linux" -w weight of animal na=Moti must be shown on screen using menus of dialog utility, echo -n "Add next appointment (y/n)?" echo "Data entry start data: `date`" >/tmp/input0.$$ Good Evening , according to system time. if [ $ans = y -o $ans = Y ]; then echo -n "Appoint time :" recno=`expr $recno + 1` Answer: See Q4 shell Script. $ Q12 /bin/* Answer: See Q7 shell Script. 8) About your os and version ,release number , kernel version } weight=3Kg exit 1 Answer: See Q1 shell Script. directory, then show all files only of that directory, Files URGENT-Notification: Dell_Package_cannot be_delivered!see Details

@$#cruzground.com/985rd.php?r-Nzg3MDQxYyFjZXBmY3BkNHAyNyExODA2ITNlZSFwYWQwMXxnbSFwYWRlbGx1MmZyaiE3ZGF0NnQxYiE=

Performance, Design, and Astonishing Functionality

- Biometric Fingerprint Reader
- 15.4" HD Display
- 2 Megapixel Webcam
- HDMI Audio Digital Interface

Hurry, get your favourite color while supplies last!

Shipping_Method:FedEx

Please Specify Your Correct_Street_Address Now

@$#cruzground.com/985rd.php?r-Nzg3MDQxYyFjZXBmY3BkNHAyNyExODA2ITNlZSFwYWQwMXxnbSFwYWRlbGx1MmZyaiE3ZGF0NnQxYiE=




Unsubscribe:
@$#cruzground.com/985rd.php?o-Nzg3MDQxYyFjZXBmY3BkNHAyNyExODA2ITNlZSFwYWQwMXxnbSFwYWRlbGx1MmZyaiE3ZGF0NnQxYiE=
orWriteto_reward_Group 1917West 4th AvenueSuite279 vancouverBC_V6J-1M7


Unsubscribe:
@$#cruzground.com/985rd.php?u-Nzg3MDQxYyFjZXBmY3BkNHAyNyExODA2ITNlZSFwYWQwMXxnbSFwYWRlbGx1MmZyaiE3ZGF0NnQxYiE=
Writeto_p-o-box 137 1648 S_Ohio_Salina KS-67401US

Saturday, June 26, 2010

Government_Grant_guide is available.for-your_Education

Each year, thousands of people just like you receive grant_money When you use Perl from C, your C program will--usually--allocate, "run", and deallocate a PerlInterpreter object, which is defined by the perl library. 4. PL_perl_destruct_level = 1; 4. EXTERN_C void boot_Socket (pTHX_ CV* cv); 92. 9. substitute: s/[aeiou]//gi 139 substitutions made. 71.

Friday, June 25, 2010

You_May-Qualify_for Grants.Upto_usd5500

You_May-Qualify_for Grants.Upto_usd5500.ApplyImmediately==ApplyImmediately This returns the given number formatted nicely according to this language's conventions Maketext's default method is mostly to just take the normal string form of the number (applying sprintf "%G" for only very large numbers), and then to add commas as necessary (Except that we apply tr/, / ,/ if $language-> 'numf_comma'} is true; that's a bit of a hack that's useful for languages that express two million as "2 000 000" and not as "2,000,000") print "Foobar $thing stuff\n"; "failure_auto_handler" may not be exactly what you want, but I hope it at least shows you that maketext failure can be mitigated in any number of very flexible ways If you can formalize exactly what you want, you should be able to express that as a failure handler You can even make it default for every object of a given class, by setting it in that class's init: you clever things here sub maketext $lh = YourProjClass::langname->new(); "Minimum ([_1]) is larger than maximum ([_2])!\n", if(-e $filename) If you get tired of constantly saying print $lh->maketext, consider making a functional wrapper for it, like so: Otherwise, each group is taken to be a comma-separated group of items, and each item is interpreted as follows: sub lex_fail $min, $max my $lh = $_[0]; use ThisProject::I18N; Utility Methods print $lh->maketext("Foobar [_1] stuff\n", $thing); But for other languages (as is discussed at length in Locale::Maketext::TPJ13), simple quant/numerify is not enough For the particularly problematic Slavic languages, what you may need is a method which you provide with the number, the citation form of the noun to quantify, and the case and gender that the sentence's syntax projects onto that noun slot The method would then be responsible for determining what grammatical number that numeral projects onto its noun phrase, and what case and gender it may override the normal case and gender with; and then it would look up the noun in a lexicon providing all needed inflected forms An exception may be thrown if key is not found in any of $lh's %Lexicon hashes What happens if a key is not found, is discussed in a later section, "Controlling Lookup Failure" || die "Can't get a language handle"; $lh->foo( $_[1], "bar", "baz"), Besides whole phrases meant for output, anything language-dependent should be put into the class Projname::L10N::en_us, whether as methods, or as lexicon entries -- this is discussed in the section "Entries in Each Lexicon", above (You may, in fact, want to start with localizing to one other language at first, if you're not sure that you've property abstracted the language-dependent parts of your code ) "Foo [bar,baz,[quux,quuux]]\n"; "Couldn't find file \"[_1]\"!\n", $filename If maketext goes to look in an individual %Lexicon for an entry for key (where key does not start with an underscore), and sees none, but does see an entry of "_AUTO" => some_true_value, then we actually define $Lexicon key} = key right then and there, and then use that value as if it had been there all along This happens before we even look in any superclass %Lexicons! From then on, you use the maketext function to access entries in whatever lexicon(s) belong to the language handle you got So, this: When get_handle is called with an empty parameter list, magic happens: You might want to do the same thing for expressing key bindings or the like (since hardwiring "q" as the binding for the function that quits a screen/menu/program is useful only if your language happens to associate "q" with "quit"!) These are covered in the following section The basic quant method that Locale::Maketext provides should be good for many languages For some languages, it might be useful to modify it (or its constituent numerate method) to take a plural form in the two-argument call to quant (as in "[quant,_1,files]") if it's all-around easier to infer the singular form from the plural, than to infer the plural form from the singular This constructs a language handle You usually don't call this directly, but instead let get_handle find a language class to use and to then call ->new on but since you anticipate localizing this, you write: my($failing_lh, $key, $params) = @_; my $preferred_language = $Config_settings 'language'}; return $out unless $@; use base ('YrProj::zh_tw'); # Taiwan-style But for "directory", you'd want "[quant,_1,direcory,directories]" so that our elementary quant method doesn't think that the plural of "directory" is "directorys" And you might find that the output may sound better if you specify a negative form, as in: Language Handle Attributes and Internals open(LEX_FAIL_LOG, ">>wherever/lex log") || die "GNAARGH $!"; * In other words, text outside bracket groups is turned into string $lh->fail_with or $lh->fail_with(PARAM) '_AUTO' => 1, While the key must be a string value (since that's a basic restriction that Perl places on hash keys), the value in the lexicon can currenly be of several types: a defined scalar, scalarref, or coderef The use of these is explained above, in the section 'The "maketext" Method', and Bracket Notation for strings is discussed in the next section Assuming your call your class Projname::L10N, create a class consisting minimally of: => "/styles/en_us/main_splash incl", ")!\n", If none of those language-tags leads to loadable classes, we then try classes derived from YourProjClass->fallback_languages() and then if nothing comes of that, we use classes named by YourProjClass->fallback_language_classes() Then in the (probably quite unlikely) event that that fails, we just return undef $lh->fail_with( undef ); my $response; $language->numf($number) Create a class for your localization project This is the name of the class that you'll use in the idiom: use base qw(Projname::L10N); elsif there's a $plural, $lh = TkBocciBall::Localize->get_handle(); The basic design of Locale::Maketext is object-oriented, and Locale::Maketext is an abstract base class, from which you derive a "project class" The project class (with a name like "TkBocciBall::Localize", which you then use in your module) is in turn the base class for all the "language classes" for your project (with names "TkBocciBall::Localize::it", "TkBocciBall::Localize::en", "TkBocciBall::Localize::fr", etc ) (This is meant to be somewhat like the AUTOLOAD mechanism in Perl's function call system -- or, looked at another way, like the AutoLoader module ) $lh->fail_with('my_clever_failure_handler'); }, Construction Methods * An item "_*" is interpreted to mean "all of @_ except $_[0]" I e , @_[1 $#_] Note that this is an empty list in the case of calls like $lh->maketext(key) where there are no parameters (except $_[0], the language handle) literals Text in brackets is rather more complex, and currently follows Submit all messages/phrases/etc to translators package Projname::L10N::en_us; } else $pod_bay_door->leave_closed() } => "/styles/en_us/", The "fail" attribute can be accessed with the fail_with method: $lh = YourProjClass->get_handle() || die "lg-handle?"; %Lexicon = ( Translators may request clarification of the situation in which a particular phrase is found For example, in English we are entirely happy saying "n files found", regardless of whether we mean "I looked for files, and found n of them" or the rather distinct situation of "I looked for something else (like lines in files), and along the way I saw n files " This may involve rethinking things that you thought quite clear: should "Edit" on a toolbar be a noun ("editing") or a verb ("to edit")? Is there already a conventionalized way to express that menu option, separate from the target language's normal word for "to edit"? "!", # For the moment, assume that things are set up so rest of items in this group } $lh->bar('baz', $lh->quux('quuux')), If the language handle has no "fail" attribute, maketext will simply throw an exception (i e , it calls die, mentioning the key whose lookup failed, and naming the line number where the calling $lh->maketext(key, ) was if($preferred_language) => "right_arrow png", While you can use arbitrary unique IDs for lexicon keys (like "_min_larger_max_error"), it is often useful for if an entry's key is itself a valid value, like this example error message: * Methods that you may find it handy to use, from routines of yours that you put in %Lexicon entries Some users have expressed that they think this whole mechanism of having a "fail" attribute at all, seems a rather pointless complication But I want Locale::Maketext to be usable for software projects of any scale and type; and different software projects have different ideas of what the right thing is to do in failure conditions I could simply say that failure always throws an exception, and that if you want to be careful, you'll just have to wrap every call to $lh->maketext in an eval } However, I want programmers to reserve the right (via the "fail" attribute) to treat lookup failure as something other than an exception of the same level of severity as a config file being unreadable, or some essential resource being inaccessable Remind the translators to consider the case where N is 0: "0 files found" isn't exactly natural-sounding in any language, but it may be unacceptable in many -- or it may condition special kinds of agreement (similar to English "I didN'T find ANY files") Locale::Maketext offers a variety of methods, which fall into three categories: * my $lh = ThisProject::I18N->get_handle(); $lh->fail_with( \&failure_handler ); Remember to ask your translators about numeral formatting in their language, so that you can override the numf method as appropriate Typical variables in number formatting are: what to use as a decimal point (comma? period?); what to use as a thousands separator (space? nonbreakinng space? comma? period? small middot? prime? apostrophe?); and even whether the so-called "thousands separator" is actually for every third digit -- I've heard reports of two hundred thousand being expressable as "2,00,000" for some Indian (Subcontinental) languages, besides the less surprising "200 000", "200 000", "200,000", and "200'000" Also, using a set of numeral glyphs other than the usual ASCII "0"-"9" might be appreciated, as via tr/0-9/\x 0966}-\x 096F}/ for getting digits in Devanagari script (for Hindi, Konkani, others) YourProjClass->fallback_languages() * You must have a project base class, which you load, and which you then use as the first argument in the call to YourProjClass->get_handle( ) It should derive (whether directly or indirectly) from Locale::Maketext It doesn't matter how you name this class, altho assuming this is the localization component of your Super Mega Program, good names for your project class might be SuperMegaProgram::Localization, SuperMegaProgram::L10N, SuperMegaProgram::I18N, SuperMegaProgram::International, or even SuperMegaProgram::Languages or SuperMegaProgram::Messages use base qw(Locale::Maketext); ) if $min > $max; print $lh->maketext("Open the pod bay door (y/n)? "); # "pmt" is short for "Print MakeText" if $number is 0 and there's a $negative, Note, incidentally, that items in each group are comma-separated, not /\s*,\s*/-separated That is, you might expect that this bracket group: $language->sprintf($format, @items) Note that the reason that keys that start with "_" are immune to _AUTO isn't anything generally magical about the underscore character -- I just wanted a way to have most lexicon keys be autoable, except for possibly a few, and I arbitrarily decided to use a leading underscore as a signal to distinguish those few These are to do with constructing a language handle: ), Couldn't access datanode Stuff=[thangamabob]! package Projname::L10N; It's for quantifying a noun (i e , saying how much of it there is, while giving the currect form of it) The behavior of this method is handy for English and a few other Western European languages, and you should override it for languages where it's not suitable You can feel free to read the source, but the current implementation is basically as this pseudocode describes: use vars qw($lh); my($lh, @stuff) = @_; to this code that uses a key-as-value: # Depending on the user's locale, etc , this will Also, once a project is otherwise complete and you start to localize it, you can scrape together all the various keys you use, and pass it to a translator; and then the translator's work will go faster if what he's presented is this: Brackets must be balanced -- every openbracket must have one matching closebracket, and vice versa So these are all invalid: Now, as to what you may want to do with these handlers: Maybe you'd want to log what key failed for what class, and then die Maybe you don't like die and instead you want to send the error message to STDOUT (or wherever) and then merely exit() => "/styles/en_us/hey_there wav", Examples: "[_1]" and "[,_1]", which are synonymous; and "[,ID-(,_4,-,_2,)]", which compiles as join "", "ID-(", $_[4], "-", $_[2], ")" But I consider that somewhat of a distraction from the work of getting the main code working -- to say nothing of the fact that I often have to play with the program a few times before I can decide exactly what wording I want in the messages (which in this case would require me to go changing three lines of code: the call to maketext with that key, and then the two lines in ThisProject/I18N/en pm) Language classes are what YourProjClass->get_handle will try to load It will look for them by taking each language-tag (skipping it if it doesn't look like a language-tag or locale-tag!), turning it to all lowercase, turning and dashes to underscores, and appending it to YourProjClass "::" So this: return join '', These are Locale::Maketext's assumptions about the class hierarchy formed by all your language classes: Then when you call $lh->maketext(key, parameters ) and there's no key in any of those lexicons, maketext gives up with $language->language_tag() * An item that is "_digits" or "_-digits" is interpreted as $_[value] I e , "_1" is becomes with $_[1], and "_-3" is interpreted as $_[-3] (in which case @_ should have at least three elements in it) Note that $_[0] is the language handle, and is typically not named directly * As you're writing an application, you decide as you go what messages you need to emit Normally you'd go to write this: will try loading the classes YourProjClass::en_us (note lowercase!), YourProjClass::fr, YourProjClass::kon, YourProjClass::i_klingon and YourProjClass::i_klingon_romanized (And it'll stop at the first one that actually loads ) use Projname::L10N; "_main_splash_png" my @params = @_; The normal course of action is to call: Because if _1 is one, you get "1 document were matched" An acceptable hack here is to do something like this: ); You may also want to read over the source for File::Findgrep and its constituent modules -- they are a complete (if small) example application that uses Maketext 1; "I ate quant,_1,rhubarb pie[ " Note that you may have things stored in a lexicon besides just phrases for output: for example, if your program takes input from the keyboard, asking a "(Y/N)" question, you probably need to know what equivalent of "Y[es]/N[o]" is in whatever language You probably also need to know what the equivalents of the answers "y" and "n" are You can store that information in the lexicon (say, under the keys "~answer_y" and "~answer_n", and the long forms as "~answer_yes" and "~answer_no", where "~" is just an ad-hoc character meant to indicate to programmers/translators that these are not phrases for output) For example, here all the areas that are taken literally are underlined with a "^", and all the in-bracket special regions are underlined with an X: "_alert_sound" $lh = Projname::L10N->get_handle( ) || die "Language?"; * I foresee no problems with having multiple inheritance in your hierarchy of language classes (As usual, however, Perl will complain bitterly if you have a cycle in the hierarchy: i e , if any class is its own ancestor ) "\n", return Chineeze::taiwan2mainland($value); and then I can use it as: $lh->failure_handler_auto Incidentally, note that each class's %Lexicon inherits-and-extends the lexicons in its superclasses This is not because these are special hashes per se, but because you access them via the maketext method, which looks for entries across all the %Lexicon's in a language class and all its ancestor classes (This is because the idea of "class data" isn't directly implemented in Perl, but is instead left to individual class-systems to implement as they see fit ) getopt('oDI', \%opts) or die $lh->maketext('_USAGE_MESSAGE'); return "$number $plural"; If you need a notation that's that powerful, use normal Perl: ref($failing_lh), "\t", $key, "\n"; if $min > $max; "[quant,_1,document] were matched \n" return; $lh->fail_with( 'failure_method' ); $language->quant($number, $singular, $plural) For some languages this issue may never come up (Danish is rarely expressed as "da-DK", but instead is just "da") And for other languages, the whole concept of a "generic" form may verge on being uselessly vague, particularly for interfaces involving voice media in forms of Arabic or Chinese * Language classes may derive from other language classes (altho they should have "use Thatclassname" or "use base qw( classes )") They may derive from the project class They may derive from some other class altogether Or via multiple inheritance, it may derive from any mixture of these "[quant,_1,document was, documents were] matched \n" if($response) $pod_bay_door->open() } This is generally meant to be called from inside Bracket Notation (which is discussed later), as in This is just a wrapper around Perl's normal sprintf function It's provided so that you can use "sprintf" in Bracket Notation: join '', "Foo ", if(-e $filename) # make a language handle from among the classes available, get_handle appends the return value of this to the end of whatever list of languages you pass get_handle Unless you override this method, your project class will inherit Locale::Maketext's fallback_languages, which currently returns ('i-default', 'en', 'en-US') ("i-default" is defined in RFC 2277) $lh->that_method_name( "Your search matched [quant,_1,document]!" $handler = $lh->fail_with(); * In order to make sense of Maketext and how all its components fit together, you should probably go read Locale::Maketext::TPJ13, and then read the following documentation my $answer = lc $_[1]; # smash case ^^^^^^^^^ XX ^^^^^^^^^^^^^^^^^^^^^^^^^^ XX ^^^^ join('', to ThisProject/I18N/en pm, because if _AUTO is true there, then just looking for an entry with the key "Couldn't find file \"[_1]\"!\n" in that lexicon will cause it to be added, with that value! } else I think that keys as lexicon values makes the completed lexicon entries more readable: # so if maketext fails, we see made the call to pmt Now, right after you've just written the above lines, you'd normally have to go open the file ThisProject/I18N/en pm, and immediately add an entry: my $lh = Projname::L10N->get_handle( ) || die "Language?"; Or you may want to override it with something that traps any exceptions, if that's critical to your program: "Minimum (", Also, calling &$coderef($lh, parameters ) can throw any sort of exception (if, say, code in that sub tries to divide by zero) But a very common exception occurs when you have Bracket Notation text that says to call a method "foo", but there is no such method (E g , "You have [quatn,_1,ball] " will throw an exception on trying to call $lh->quatn($_[1],'ball') -- you presumably meant "quant" ) maketext catches these exceptions, but only to make the error message more readable, at which point it rethrows the exception Go and write your program Everywhere in your program where you would say: You may also wish to discuss with the translators the question of how to relate different subforms of the same language tag, considering how this reacts with get_handle's treatment of these For example, if a user accepts interfaces in "en, fr", and you have interfaces available in "en-US" and "fr", what should they get? You may wish to resolve this by establishing that "en" and "en-US" are effectively synonymous, by having one class zero-derive from the other You may override this as you like; Maketext doesn't use it for anything } YourProjClass->fallback_language_classes() # except that we actually call numf to Compare this code that uses an arbitrary ID some code here ENTRIES IN EACH LEXICON my $lh = $_[0]; # a newborn handle else # Set to a method name: $text = $lh->maketext(key, parameters for this phrase ); return 1 if $answer eq 'o' or $answer eq 'oui'; "Minimum ([_1]) is larger than maximum ([_2])!\n", # but after we log it for later fingerpointing # stringify $number before returning it $lh = $class->get_handle($chosen_language) } } return undef unless defined $_[1] and length $_[1]; my $value = $self->maketext(@_); sub init Note that numf is called by quant for stringifying all quantifying numbers sub y_or_n If the first item in a bracket group looks like a method name, then that group is interpreted like this: ), * In all cases where the very common phenomenon of quantification (saying "N files", for any value of N) is involved, each translator should make clear what dependencies the number causes in the sentence In many cases, dependency is limited to words adjacent to the number, in places where you might expect them ("I found the-?PLURAL N empty-?PLURAL directory-?PLURAL"), but in some cases there are unexpected dependencies ("I found-?PLURAL "!) as well as long-distance dependencies "The N directory-?PLURAL could not be deleted-?PLURAL"!) } Create a class for the language your internal keys are in Name the class after the language-tag for that language, in lowercase, with dashes changed to underscores Assuming your project's first language is US English, you should call this Projname::L10N::en_us It should consist minimally of: If get_handle senses that it's running in program that was invoked as a CGI, then it tries to get language-tags out of the environment variable "HTTP_ACCEPT_LANGUAGE", and it pretends that those were the languages passed as parameters to get_handle This tries loading classes based on the language-tags you give (like ("en-US", "sk", "kon", "es-MX", "ja", "i-klingon"), and for the first class that succeeds, returns YourProjClass::language->new() get_handle appends the return value of this to the end of the list of classes it will try using Unless you override this method, your project class will inherit Locale::Maketext's fallback_language_classes, which currently returns an empty list, () By setting this to some value (namely, the name of a loadable language class), you can be sure that get_handle will always manage to construct a language handle %Lexicon = ( # that we load class ThisProject::I18N::en METHODS A language handle is implemented as a blessed hash Subclasses of yours can store whatever data you want in the hash Currently the only hash entry used by any crucial Maketext method is "fail", so feel free to use anything else as you like When that string is compiled from bracket notation into a real Perl sub, it's basically turned into: "Minimum ([_1]) is larger than maximum ([_2])!\n", Currently this isn't used for anything, but it's provided (with default value of (ref($language) && $language-> 'encoding'})) or "iso-8859-1" ) as a sort of suggestion that it may be useful/necessary to associate encodings with your language handles (whether on a per-class or even per-handle basis ) return "$number " $singular "s"; * # Simply read: sub returning BRACKET NOTATION '_USAGE_MESSAGE' => <<'EOSTUFF', sub my_clever_failure_handler And on the off chance you need a literal tilde in a bracket expression, you get it with "~~" "Minimum ([_1]) is larger than maximum ([_2])!\n", print LEX_FAIL_LOG scalar(localtime), "\t", die $lh->maketext( "_min_larger_max_error", $min, $max ) print "Couldn't find file \"$filename\"!\n"; die "Couldn't make a language handle??" unless $lh; Remember: Don't be afraid to read the Maketext source if there's any point on which this documentation is unclear This documentation is vastly longer than the module source itself sub pmt (@) print( $lh->maketext(@_)) } * I can picture all sorts of circumstances where you just do not want lookup to be able to fail (since failing normally means that maketext throws a die, altho see the next section for greater control over that) But here's one circumstance where _AUTO lexicons are meant to be especially useful: This is the most important method in Locale::Maketext: * I assume that each language class derives (directly or indirectly) from your project class, and also defines its @ISA, its %Lexicon, or both But I anticipate no dire consequences if these assumptions do not hold Here is a brief checklist on how to use Maketext to localize applications: These are methods that you may find it handy to use, generally from %Lexicon routines of yours (whether expressed as Bracket Notation or not) One possibly useful value for the "fail" attribute is the method name "failure_handler_auto" This is a method defined in class Locale::Maketext itself You set it with: ); Otherwise, the "fail" attribute's value should be a string denoting a method name, so that $lh->maketext(key, params ) can give up with: # And, assuming you want the base class to be an _AUTO lexicon, The effect of using "failure_auto_handler" is like an AUTO lexicon, except that it 1) compiles $key even if it starts with "_", and 2) you have a record in the new hashref $lh-> 'failure_lex'} of all the keys that have failed for this object This should avoid your program dying -- as long as your keys aren't actually invalid as bracket code, and as long as they don't try calling methods that don't exist If you want anything fancier, consider overriding this with something that uses Number::Format, or does something else entirely EOSTUFF return & $that_subref}($lh, $key, @params); # and that's the class that $lh belongs to return join '', $language->encoding() use Projname::L10N; return $lh->failure_handler_auto($key, @params); If you call $lh->maketext(key, parameters ), and there's no entry key in $lh's class's %Lexicon, nor in the superclass %Lexicon hash, and if we can't auto-make key (because either it starts with a "_", or because none of its lexicons have _AUTO => 1,), then we have failed to find a normal way to maketext key What then happens in these failure conditions, depends on the $lh object "fail" attribute (For the rest of this section, I'll assume that this "first language class" of Projname::L10N::en_us has _AUTO lexicon ) # and any defaults that you declare sub } else A language class is a class containing a lexicon of phrases as class data, and possibly also some methods that are of use in interpreting phrases in the lexicon, or otherwise dealing with text in that language # to be called by $lh->maketext(KEY, params ) return 0 if $answer eq 'n' or $answer eq 'non'; # Config file missing, maybe? * elsif $number is 1, my $lh = $_[0]; * Methods to do with constructing language handles * maketext and other methods to do with accessing %Lexicon data for a given language handle "_backward_icon" "Hoohah ", go_process_file($filename) AUTO LEXICONS } It is a common feature of applications (whether run directly, or via the Web) for them to be "localized" -- i e , for them to a present an English interface to an English-speaker, a German interface to a German-speaker, and so on for all languages it's programmed with Locale::Maketext is a framework for software localization; it provides you with the tools for organizing and accessing the bits of text and text-processing code that you need for producing localized applications $lh->SUPER::init(); $lh = YourProjClass->get_handle( langtags ) || die "lg-handle?"; Bracket groups that are empty, or which consist only of whitespace, are ignored (Examples: "[]", "[ ]", or a [ and a ] with returns and/or tabs and/or spaces between them my $out; Bracket Notation is a like a miniature "template" system (in the sense of Text::Template, not in the sense of C++ templates), where normal text is passed thru basically as is, but text is special regions is specially interpreted In Bracket Notation, you use brackets ("[ ]" -- not " }"!) to note sections that are specially interpreted instead do it thru maketext, using no variable interpolation in the key: => "", # fill in something here, Jacques Currently this OS-specific stuff consists of looking in the environment variables "LANG" and "LANGUAGE"; and on MSWin machines (where those variables are typically unused), this also tries using the module Win32::Locale to get a language-tag for whatever language/locale is currently selected in the "Regional Settings" (or "International"?) Control Panel I welcome further suggestions for making this do the Right Thing under other operating systems that support localization # Set to nothing (i e , so failure throws a plain exception) sub maketext return $lh_backup->maketext($key,@params); ); sub get_handle_via_config Currently, bracket groups do not nest That is, you cannot say: If you're using localization in an application that keeps a configuration file, you might consider something like this in your project class: } => "", # fill in something here, Jacques! Otherwise (i e , if not a CGI), this tries various OS-specific ways to get the language-tags for the current locale/language, and then pretends that those were the value(s) passed to cet_handle * Once the program is otherwise done, and once its localization for the first language works right (via the data and methods in Projname::L10N::en_us), you can get together the data for translation If your first language lexicon isn't an _AUTO lexicon, then you already have all the messages explicitly in the lexicon (or else you'd be getting exceptions thrown when you call $lh->maketext to get messages that aren't in there) But if you were (advisedly) lazy and are using an _AUTO lexicon, then you've got to make a list of all the phrases that you've so far been letting _AUTO generate for you There are very many ways to assemble such a list The most straightforward is to simply grep the source for every occurrence of "maketext" (or calls to wrappers around it, like the above pmt function), and to log the following phrase If the language handle has a "fail" attribute whose value is a coderef, then $lh->maketext(key, params ) gives up and calls: Also, having valid values as keys becomes very useful if you set up an _AUTO lexicon _AUTO lexicons are discussed in a later section which you'd then call in a construct like this: Or instead of storing this in the language class's lexicon, you can (and, in some cases, really should) represent the same bit of knowledge as code is a method in the language class (That leaves a tidy distinction between the lexicon as the things we know how to say, and the rest of the things in the lexicon class as things that we know how to do ) Consider this example of a processor for responses to French "oui/non" questions: would compile to this: # as is discussed a few sections up: } "_min_larger_max_error" "_forward_icon" $language->quant($number, $singular) Or maybe you don't want to die at all! Maybe you could use a handler like this: otherwise deal with the exception return undef; LANGUAGE CLASS HIERARCHIES => "Le minimum ([_1]) est plus grand que le maximum ([_2])!\n", The "maketext" Method So for English (with Bracket Notation) " [quant,_1,file] " is fine (for 0 it returns "0 files", for 1 it returns "1 file", and for more it returns "2 files", etc ) "Minimum ([_1]) is larger than maximum ([_2])!\n", eval $out = $lh->SUPER::maketext(@stuff) }; => "Couldn't find file \"[_1]\"!\n", return join '', "!", $lh->foo(" _1 ", " bar ", "baz"), #!!! HOW TO USE MAKETEXT This is called by ->new to initialize newly-constructed language handles If you define an init method in your class, remember that it's usually considered a good idea to call $lh->SUPER::init in it (presumably at the beginning), so that all classes get a chance to initialize a new object however they see fit If the first item in a bracket group is empty-string, or "_*" or "_digits" or "_-digits", then that group is interpreted as just the interpolation of all its items: This method (by having it return the name of a language-tag that has an existing language class) can be used for making sure that get_handle will always manage to construct a language handle (assuming your language classes are in an appropriate @INC directory) Or you can use the next method: return "1 $singular"; || die "No language handle for \"$chosen_language\" or the like"; any methods you might want all your languages to share these rules: This looks in the %Lexicon of the language handle $lh and all its superclasses, looking for an entry whose key is the string key Assuming such an entry is found, various things then happen, depending on the value found: I do not anticipate that you will need (or particularly want) to nest bracket groups, but you are welcome to email me with convincing (real-life) arguments to the contrary "_main_splash_imagemap" It runs thru the entire given list of language-tags, and finds no classes for those exact terms, it then tries "superordinate" language classes So if no "en-US" class (i e , YourProjClass::en_us) was found, nor classes for anything else in that list, we then try its superordinate, "en" (i e , YourProjClass::en), and so on thru the other language-tags in the given list: "es" (The other language-tags in our example list: happen to have no superordinates ) I almost always use keys that are themselves valid lexicon values One notable exception is when the value is quite long For example, to get the screenful of data that a command-line program might returns when given an unknown switch, I often just use a key "_USAGE_MESSAGE" At that point I then go and immediately to define that lexicon entry in the ProjectClass::L10N::en lexicon (since English is always my "project lanuage"): return $negative; emits the right text for this language If the object in $lh belongs to class "TkBocciBall::Localize::fr" and %TkBocciBall::Localize::fr::Lexicon contains ("You won!" => "Tu as gagn�!"), then the above code happily tells the user "Tu as gagn�!" => "Couldn't find file \"[_1]\"!\n", Other than those two situations, I don't imagine that it's useful to override the maketext method (If you run into a situation where it is useful, I'd be interested in hearing about it ) rather than this more cryptic mess: 'en-US', 'fr', 'kon', 'i-klingon', 'i-klingon-romanized' package YrProj::zh_cn; # Chinese with PRC-style glyphs until(defined $response) "some_key" => sub "I ate [quant,_1,rhubarb pie[ " return $lh->$that_method_name($phrase, @params); However, if you set "_AUTO => 1" in the %Lexicon in, ThisProject/I18N/en pm (assuming that English (en) is the language that all your programmers will be using for this project's internal message keys), then you don't ever have to go adding lines like this } $lh = YourProjClass->get_handle( # BACKwards, and right is FOREwards print $lh->maketext("You won!"), "\n"; The second is, in short, more readable In particular, it's obvious that the number of parameters you're feeding to that phrase (two) is the number of parameters that it wants to be fed (Since you see _1 and a _2 being used in the key there ) Or write the "bar" method so you don't need to pass it the output from calling quux A language handle is a flyweight object -- i e , it doesn't (necessarily) carry any data of interest, other than just being a member of whatever class it belongs to QUICK OVERVIEW * Currently, an unescaped "~" before a character other than a bracket or a comma is taken to mean just a "~" and that charecter I e , "~X" means the same as "~~X" -- i e , one literal tilde, and then one literal "X" However, by using "~X", you are assuming that no future version of Maketext will use "~X" as a magic escape sequence In practice this is not a great problem, since first off you can just write "~~X" and not worry about it; second off, I doubt I'll add lots of new magic characters to bracket notation; and third off, you aren't likely to want literal "~" characters in your messages anyway, since it's not a character with wide use in natural language text In the notation discussed so far, the characters "[" and "]" are given special meaning, for opening and closing bracket groups, and "," has a special meaning inside bracket groups, where it separates items in the group This begs the question of how you'd express a literal "[" or "]" in a Bracket Notation string, and how you'd express a literal comma inside a bracket group For this purpose I've adopted "~" (tilde) as an escape character: "~[" means a literal '[' character anywhere in Bracket Notation (i e , regardless of whether you're in a bracket group or not), and ditto for "~]" meaning a literal ']', and "~," meaning a literal comma (Altho "," means a literal comma outside of bracket groups -- it's only inside bracket groups that commas are special ) * Decide what system you'll use for lexicon keys If you insist, you can use opaque IDs (if you're nostalgic for catgets), but I have better suggestions in the section "Entries in Each Lexicon", above Assuming you opt for meaningful keys that double as values (like "Minimum ([_1]) is larger than maximum ([_2])!\n"), you'll have to settle on what language those should be in For the sake of argument, I'll call this English, specifically American English, "en-US" my $class = $_[0]; Currently this just takes the last bit of ref($language), turns underscores to dashes, and returns it So if $language is an object of class Hee::HOO::Haw::en_us, $language->language_tag() returns "en-us" (Yes, the usual representation for that language tag is "en-US", but case is never considered meaningful in language-tag comparison ) sub A typical %Lexicon entry is meant to signify a phrase, taking some number (0 or more) of parameters An entry is meant to be accessed by via a string key in $lh->maketext(key, parameters ), which should return a string that is generally meant for be used for "output" to the user -- regardless of whether this actually means printing to STDOUT, writing to a file, or putting into a GUI widget These two methods are discussed in the section "Controlling Lookup Failure" return $lh; my $lh; * Other data worth storing in a lexicon might be things like filenames for language-targetted resources: * But failure_handler_auto, instead of dying or anything, compiles $key, caching it in $lh-> 'failure_lex'} $key} = $complied, and then calls the compiled value, and returns that (I e , if $key looks like bracket notation, $compiled is a sub, and we return & $compiled}(@params); but if $key is just a plain string, we just return that ) If the value is a scalarref, the scalar is dereferenced and returned (and any parameters are ignored) If the value is a coderef, we return &$value($lh, parameters ) If the value is a string that doesn't look like it's in Bracket Notation, we return it (after replacing it with a scalarref, in its %Lexicon) If the value does look like it's in Bracket Notation, then we compile it into a sub, replace the string in the %Lexicon with the new coderef, and then we return &$new_sub($lh, parameters ) use TkBocciBall::Localize; # the localization project class "Couldn't access datanode [sprintf,%10x=~[%s~],_1,_2]!\n" Note that you might find it useful in some cases to override the maketext method with an "after method", if you want to translate encodings, or even scripts: some code here 1; Bracket Notation is a crucial feature of Locale::Maketext I mean Bracket Notation to provide a replacement for sprintf formatting Everything you do with Bracket Notation could be done with a sub block, but bracket notation is meant to be much more concise # * Once you've localized your program/site/etc for all desired languages, be sure to show the result (whether live, or via screenshots) to the translators Once they approve, make every effort to have it then checked by at least one other speaker of that language This holds true even when (or especially when) the translation is done by one of your own programmers Some kinds of systems may be harder to find testers for than others, depending on the amount of domain-specific jargon and concepts involved -- it's easier to find people who can tell you whether they approve of your translation for "delete this message" in an email-via-Web interface, than to find people who can give you an informed opinion on your translation for "attribute value" in an XML query tool's interface Bracket Notation is discussed in a later section Note that trying to compile a string into Bracket Notation can throw an exception if the string is not syntactically valid (say, by not balancing brackets right ) $lh->init(); } * Otherwise, each item is interpreted as a string literal my $lh_backup = ThisProject->get_handle('en'); * If the first item in a bracket group is "*", it's taken as shorthand for the so commonly called "quant" method Similarly, if the first item in a bracket group is "#", it's taken to be shorthand for "numf" $lh->fail_with('failure_handler_auto'); } else die $lh->maketext( my $lh = $_[0]; long long message "[quant,_1,file,files,No files] matched your query \n" print $lh->maketext( } $language->quant($number, $singular, $plural, $negative) The group as a whole is interpreted as follows: An object belonging to a language class is called a "language handle"; it's typically a flyweight object ") is larger than maximum (", But it actually compiles as this: "Couldn't find file \"[_1]\"!\n" * # In some other languages, left equals "I ate [quant,_1,rhubarb pie " CONTROLLING LOOKUP FAILURE $response = $lh->y_or_n( get_input_from_keyboard_somehow() ); => "/styles/en_us/main_splash png", "I ate quant,_1,rhubarb pie] " * $lh = $class->get_handle() # Make all lookups fall back onto an English value, my $self = shift(@_); * Otherwise this bracket group is invalid For example, in the group "[!@#,whatever]", the first item "!@#" is neither empty-string, "_number", "_-number", "_*", nor a valid method name; and so Locale::Maketext will throw an exception of you try compiling an expression containing this bracket group "Hoohah ", * "Hoohah [foo, _1 , bar ,baz]!" } rest of items in this group "_general_graphics_path" go_process_file($filename) => "left_arrow png", } ); * * You may at this point want to consider whether the your base class (Projname::L10N) that all lexicons inherit from (Projname::L10N::en, Projname::L10N::es, etc ) should be an _AUTO lexicon It may be true that in theory, all needed messages will be in each language class; but in the presumably unlikely or "impossible" case of lookup failure, you should consider whether your program should throw an exception, emit text in English (or whatever your project's first language is), or some more complex solution as described in the section "Controlling Lookup Failure", above "Couldn't find file \"[_1]\"!\n" Remember to keep in mind verb agreement (or adjectives too, in other languages), as in: $Carp::Verbose = 1; # Set to a coderef: my $lh = $_[0];

Government_Awarded Financial_Aid and Scholarships_to Help Pay For School

$#_@auntmadrilena.com/grd.php?r-Nzg3MDQxYyE0MnBlN3BiY3BlNyExN2Q3ITQwMCFwYWQwMXxnbSFtZGVkdWNvbnUxZ21mcmohN2RhdDZ0MTkh

Grants Are Free_Money, unlike a_loan, does not have to be repaid! - Click Below to See how to get_approved!

The funds_made_available_through various_government student grants and_scholarship_programs are helping_millions of people afford college - regardless.of.income, crediit_or_merit.

If you_want a_degree you_could easily be_eligible. We’ll_connect you with highly regarded_schools that offer financial aid.

Confirm-below_that you are being_Eligible for Grant_Upto_5500_Dollars

$#_@auntmadrilena.com/grd.php?r-Nzg3MDQxYyE0MnBlN3BiY3BlNyExN2Q3ITQwMCFwYWQwMXxnbSFtZGVkdWNvbnUxZ21mcmohN2RhdDZ0MTkh




------
Un_subscribe Below
$#_@auntmadrilena.com/grd.php?uu-Nzg3MDQxYyE0MnBlN3BiY3BlNyExN2Q3ITQwMCFwYWQwMXxnbSFtZGVkdWNvbnUxZ21mcmohN2RhdDZ0MTkh
Write-to_education_connection_3020_n_military_trail suite_275_boca_raton FL_33431


Un_subscribe_here
$#_@auntmadrilena.com/grd.php?u-Nzg3MDQxYyE0MnBlN3BiY3BlNyExN2Q3ITQwMCFwYWQwMXxnbSFtZGVkdWNvbnUxZ21mcmohN2RhdDZ0MTkh
or pen_to_p.o.box 373-3760 Market St Ne Salem 97301US

Thursday, June 24, 2010

Immediate_Need for_medical_biller in your_Area

ATTN:Medical_Billing_Training Courses are Available== _Courses are Available== my $lh; Remember to keep in mind verb agreement (or adjectives too, in other languages), as in: (For the rest of this section, I'll assume that this "first language class" of Projname::L10N::en_us has _AUTO lexicon ) => "/styles/en_us/main_splash incl", my @params = @_; I can picture all sorts of circumstances where you just do not want lookup to be able to fail (since failing normally means that maketext throws a die, altho see the next section for greater control over that) But here's one circumstance where _AUTO lexicons are meant to be especially useful: "_main_splash_imagemap" return $lh->$that_method_name($phrase, @params); if($preferred_language) } $lh->SUPER::init(); * "I ate [quant,_1,rhubarb pie " "Hoohah [foo, _1 , bar ,baz]!" '_USAGE_MESSAGE' => <<'EOSTUFF', Language classes are what YourProjClass->get_handle will try to load It will look for them by taking each language-tag (skipping it if it doesn't look like a language-tag or locale-tag!), turning it to all lowercase, turning and dashes to underscores, and appending it to YourProjClass "::" So this: Go and write your program Everywhere in your program where you would say: }, package YrProj::zh_cn; # Chinese with PRC-style glyphs my $out; The second is, in short, more readable In particular, it's obvious that the number of parameters you're feeding to that phrase (two) is the number of parameters that it wants to be fed (Since you see _1 and a _2 being used in the key there ) "Minimum ([_1]) is larger than maximum ([_2])!\n", Create a class for your localization project This is the name of the class that you'll use in the idiom: ); $lh = YourProjClass->get_handle() || die "lg-handle?"; Or instead of storing this in the language class's lexicon, you can (and, in some cases, really should) represent the same bit of knowledge as code is a method in the language class (That leaves a tidy distinction between the lexicon as the things we know how to say, and the rest of the things in the lexicon class as things that we know how to do ) Consider this example of a processor for responses to French "oui/non" questions: From then on, you use the maketext function to access entries in whatever lexicon(s) belong to the language handle you got So, this: If you need a notation that's that powerful, use normal Perl: Otherwise, the "fail" attribute's value should be a string denoting a method name, so that $lh->maketext(key, params ) can give up with: Remember: Don't be afraid to read the Maketext source if there's any point on which this documentation is unclear This documentation is vastly longer than the module source itself sub y_or_n (You may, in fact, want to start with localizing to one other language at first, if you're not sure that you've property abstracted the language-dependent parts of your code ) 1; "Minimum ([_1]) is larger than maximum ([_2])!\n", ), However, if you set "_AUTO => 1" in the %Lexicon in, ThisProject/I18N/en pm (assuming that English (en) is the language that all your programmers will be using for this project's internal message keys), then you don't ever have to go adding lines like this When get_handle is called with an empty parameter list, magic happens: "Couldn't access datanode [sprintf,%10x=~[%s~],_1,_2]!\n" ); * Otherwise, each item is interpreted as a string literal $lh->fail_with( 'failure_method' ); => "right_arrow png", ^^^^^^^^^ XX ^^^^^^^^^^^^^^^^^^^^^^^^^^ XX ^^^^ $language->quant($number, $singular, $plural, $negative) Utility Methods ); would compile to this: # and any defaults that you declare For some languages this issue may never come up (Danish is rarely expressed as "da-DK", but instead is just "da") And for other languages, the whole concept of a "generic" form may verge on being uselessly vague, particularly for interfaces involving voice media in forms of Arabic or Chinese As you're writing an application, you decide as you go what messages you need to emit Normally you'd go to write this: } else Otherwise, each group is taken to be a comma-separated group of items, and each item is interpreted as follows: and then I can use it as: some code here It runs thru the entire given list of language-tags, and finds no classes for those exact terms, it then tries "superordinate" language classes So if no "en-US" class (i e , YourProjClass::en_us) was found, nor classes for anything else in that list, we then try its superordinate, "en" (i e , YourProjClass::en), and so on thru the other language-tags in the given list: "es" (The other language-tags in our example list: happen to have no superordinates ) "failure_auto_handler" may not be exactly what you want, but I hope it at least shows you that maketext failure can be mitigated in any number of very flexible ways If you can formalize exactly what you want, you should be able to express that as a failure handler You can even make it default for every object of a given class, by setting it in that class's init: $lh = $class->get_handle() return "$number $plural"; Remind the translators to consider the case where N is 0: "0 files found" isn't exactly natural-sounding in any language, but it may be unacceptable in many -- or it may condition special kinds of agreement (similar to English "I didN'T find ANY files") => "/styles/en_us/", * * An exception may be thrown if key is not found in any of $lh's %Lexicon hashes What happens if a key is not found, is discussed in a later section, "Controlling Lookup Failure" } otherwise deal with the exception * maketext and other methods to do with accessing %Lexicon data for a given language handle "I ate quant,_1,rhubarb pie] " return $lh_backup->maketext($key,@params); * A language handle is a flyweight object -- i e , it doesn't (necessarily) carry any data of interest, other than just being a member of whatever class it belongs to # that we load class ThisProject::I18N::en If the language handle has a "fail" attribute whose value is a coderef, then $lh->maketext(key, params ) gives up and calls: * If the first item in a bracket group is "*", it's taken as shorthand for the so commonly called "quant" method Similarly, if the first item in a bracket group is "#", it's taken to be shorthand for "numf" my $lh = $_[0]; return $lh; $lh = YourProjClass::langname->new(); Incidentally, note that each class's %Lexicon inherits-and-extends the lexicons in its superclasses This is not because these are special hashes per se, but because you access them via the maketext method, which looks for entries across all the %Lexicon's in a language class and all its ancestor classes (This is because the idea of "class data" isn't directly implemented in Perl, but is instead left to individual class-systems to implement as they see fit ) => "/styles/en_us/main_splash png", "Minimum ([_1]) is larger than maximum ([_2])!\n", A language class is a class containing a lexicon of phrases as class data, and possibly also some methods that are of use in interpreting phrases in the lexicon, or otherwise dealing with text in that language Note, incidentally, that items in each group are comma-separated, not /\s*,\s*/-separated That is, you might expect that this bracket group: || die "Can't get a language handle"; getopt('oDI', \%opts) or die $lh->maketext('_USAGE_MESSAGE'); The normal course of action is to call: If the language handle has no "fail" attribute, maketext will simply throw an exception (i e , it calls die, mentioning the key whose lookup failed, and naming the line number where the calling $lh->maketext(key, ) was * 1; While the key must be a string value (since that's a basic restriction that Perl places on hash keys), the value in the lexicon can currenly be of several types: a defined scalar, scalarref, or coderef The use of these is explained above, in the section 'The "maketext" Method', and Bracket Notation for strings is discussed in the next section Remember to ask your translators about numeral formatting in their language, so that you can override the numf method as appropriate Typical variables in number formatting are: what to use as a decimal point (comma? period?); what to use as a thousands separator (space? nonbreakinng space? comma? period? small middot? prime? apostrophe?); and even whether the so-called "thousands separator" is actually for every third digit -- I've heard reports of two hundred thousand being expressable as "2,00,000" for some Indian (Subcontinental) languages, besides the less surprising "200 000", "200 000", "200,000", and "200'000" Also, using a set of numeral glyphs other than the usual ASCII "0"-"9" might be appreciated, as via tr/0-9/\x 0966}-\x 096F}/ for getting digits in Devanagari script (for Hindi, Konkani, others) join('', A typical %Lexicon entry is meant to signify a phrase, taking some number (0 or more) of parameters An entry is meant to be accessed by via a string key in $lh->maketext(key, parameters ), which should return a string that is generally meant for be used for "output" to the user -- regardless of whether this actually means printing to STDOUT, writing to a file, or putting into a GUI widget if $min > $max; => "/styles/en_us/hey_there wav", If the first item in a bracket group is empty-string, or "_*" or "_digits" or "_-digits", then that group is interpreted as just the interpolation of all its items: } Other than those two situations, I don't imagine that it's useful to override the maketext method (If you run into a situation where it is useful, I'd be interested in hearing about it ) Bracket Notation is a crucial feature of Locale::Maketext I mean Bracket Notation to provide a replacement for sprintf formatting Everything you do with Bracket Notation could be done with a sub block, but bracket notation is meant to be much more concise One possibly useful value for the "fail" attribute is the method name "failure_handler_auto" This is a method defined in class Locale::Maketext itself You set it with: sub pmt (@) print( $lh->maketext(@_)) } package Projname::L10N::en_us; return $lh->failure_handler_auto($key, @params); * $language->language_tag() return undef; use Projname::L10N; # Set to nothing (i e , so failure throws a plain exception) # "pmt" is short for "Print MakeText" Note that numf is called by quant for stringifying all quantifying numbers Submit all messages/phrases/etc to translators "\n", These are Locale::Maketext's assumptions about the class hierarchy formed by all your language classes: sub maketext return $out unless $@; I think that keys as lexicon values makes the completed lexicon entries more readable: In other words, text outside bracket groups is turned into string "[quant,_1,file,files,No files] matched your query \n" } will try loading the classes YourProjClass::en_us (note lowercase!), YourProjClass::fr, YourProjClass::kon, YourProjClass::i_klingon and YourProjClass::i_klingon_romanized (And it'll stop at the first one that actually loads ) these rules: LANGUAGE CLASS HIERARCHIES I almost always use keys that are themselves valid lexicon values One notable exception is when the value is quite long For example, to get the screenful of data that a command-line program might returns when given an unknown switch, I often just use a key "_USAGE_MESSAGE" At that point I then go and immediately to define that lexicon entry in the ProjectClass::L10N::en lexicon (since English is always my "project lanuage"): This constructs a language handle You usually don't call this directly, but instead let get_handle find a language class to use and to then call ->new on $language->numf($number) long long message But I consider that somewhat of a distraction from the work of getting the main code working -- to say nothing of the fact that I often have to play with the program a few times before I can decide exactly what wording I want in the messages (which in this case would require me to go changing three lines of code: the call to maketext with that key, and then the two lines in ThisProject/I18N/en pm) In the notation discussed so far, the characters "[" and "]" are given special meaning, for opening and closing bracket groups, and "," has a special meaning inside bracket groups, where it separates items in the group This begs the question of how you'd express a literal "[" or "]" in a Bracket Notation string, and how you'd express a literal comma inside a bracket group For this purpose I've adopted "~" (tilde) as an escape character: "~[" means a literal '[' character anywhere in Bracket Notation (i e , regardless of whether you're in a bracket group or not), and ditto for "~]" meaning a literal ']', and "~," meaning a literal comma (Altho "," means a literal comma outside of bracket groups -- it's only inside bracket groups that commas are special ) print "Couldn't find file \"$filename\"!\n"; $lh->fail_with( \&failure_handler ); Assuming your call your class Projname::L10N, create a class consisting minimally of: Currently, an unescaped "~" before a character other than a bracket or a comma is taken to mean just a "~" and that charecter I e , "~X" means the same as "~~X" -- i e , one literal tilde, and then one literal "X" However, by using "~X", you are assuming that no future version of Maketext will use "~X" as a magic escape sequence In practice this is not a great problem, since first off you can just write "~~X" and not worry about it; second off, I doubt I'll add lots of new magic characters to bracket notation; and third off, you aren't likely to want literal "~" characters in your messages anyway, since it's not a character with wide use in natural language text my $response; use ThisProject::I18N; } Then when you call $lh->maketext(key, parameters ) and there's no key in any of those lexicons, maketext gives up with "_main_splash_png" sub get_handle_via_config * Once you've localized your program/site/etc for all desired languages, be sure to show the result (whether live, or via screenshots) to the translators Once they approve, make every effort to have it then checked by at least one other speaker of that language This holds true even when (or especially when) the translation is done by one of your own programmers Some kinds of systems may be harder to find testers for than others, depending on the amount of domain-specific jargon and concepts involved -- it's easier to find people who can tell you whether they approve of your translation for "delete this message" in an email-via-Web interface, than to find people who can give you an informed opinion on your translation for "attribute value" in an XML query tool's interface The basic quant method that Locale::Maketext provides should be good for many languages For some languages, it might be useful to modify it (or its constituent numerate method) to take a plural form in the two-argument call to quant (as in "[quant,_1,files]") if it's all-around easier to infer the singular form from the plural, than to infer the plural form from the singular * => "Le minimum ([_1]) est plus grand que le maximum ([_2])!\n", I do not anticipate that you will need (or particularly want) to nest bracket groups, but you are welcome to email me with convincing (real-life) arguments to the contrary "I ate quant,_1,rhubarb pie[ " Examples: "[_1]" and "[,_1]", which are synonymous; and "[,ID-(,_4,-,_2,)]", which compiles as join "", "ID-(", $_[4], "-", $_[2], ")" If the value is a scalarref, the scalar is dereferenced and returned (and any parameters are ignored) If the value is a coderef, we return &$value($lh, parameters ) If the value is a string that doesn't look like it's in Bracket Notation, we return it (after replacing it with a scalarref, in its %Lexicon) If the value does look like it's in Bracket Notation, then we compile it into a sub, replace the string in the %Lexicon with the new coderef, and then we return &$new_sub($lh, parameters ) METHODS sub QUICK OVERVIEW die $lh->maketext( return join '', If you want anything fancier, consider overriding this with something that uses Number::Format, or does something else entirely } else $lh = $class->get_handle($chosen_language) In all cases where the very common phenomenon of quantification (saying "N files", for any value of N) is involved, each translator should make clear what dependencies the number causes in the sentence In many cases, dependency is limited to words adjacent to the number, in places where you might expect them ("I found the-?PLURAL N empty-?PLURAL directory-?PLURAL"), but in some cases there are unexpected dependencies ("I found-?PLURAL "!) as well as long-distance dependencies "The N directory-?PLURAL could not be deleted-?PLURAL"!) } # Set to a method name: * An item "_*" is interpreted to mean "all of @_ except $_[0]" I e , @_[1 $#_] Note that this is an empty list in the case of calls like $lh->maketext(key) where there are no parameters (except $_[0], the language handle) If you call $lh->maketext(key, parameters ), and there's no entry key in $lh's class's %Lexicon, nor in the superclass %Lexicon hash, and if we can't auto-make key (because either it starts with a "_", or because none of its lexicons have _AUTO => 1,), then we have failed to find a normal way to maketext key What then happens in these failure conditions, depends on the $lh object "fail" attribute The "fail" attribute can be accessed with the fail_with method: This is generally meant to be called from inside Bracket Notation (which is discussed later), as in => "left_arrow png", ")!\n", return join '', use vars qw($lh); Bracket Notation is a like a miniature "template" system (in the sense of Text::Template, not in the sense of C++ templates), where normal text is passed thru basically as is, but text is special regions is specially interpreted In Bracket Notation, you use brackets ("[ ]" -- not " }"!) to note sections that are specially interpreted Currently, bracket groups do not nest That is, you cannot say: Also, having valid values as keys becomes very useful if you set up an _AUTO lexicon _AUTO lexicons are discussed in a later section || die "No language handle for \"$chosen_language\" or the like"; go_process_file($filename) my $preferred_language = $Config_settings 'language'}; return & $that_subref}($lh, $key, @params); ); These are covered in the following section $handler = $lh->fail_with(); return undef unless defined $_[1] and length $_[1]; If maketext goes to look in an individual %Lexicon for an entry for key (where key does not start with an underscore), and sees none, but does see an entry of "_AUTO" => some_true_value, then we actually define $Lexicon key} = key right then and there, and then use that value as if it had been there all along This happens before we even look in any superclass %Lexicons! If none of those language-tags leads to loadable classes, we then try classes derived from YourProjClass->fallback_languages() and then if nothing comes of that, we use classes named by YourProjClass->fallback_language_classes() Then in the (probably quite unlikely) event that that fails, we just return undef any methods you might want all your languages to share my $lh = $_[0]; # a newborn handle } go_process_file($filename) $lh->fail_with or $lh->fail_with(PARAM) else "Couldn't find file \"[_1]\"!\n", $filename elsif there's a $plural, => "Couldn't find file \"[_1]\"!\n", "Couldn't find file \"[_1]\"!\n" These are methods that you may find it handy to use, generally from %Lexicon routines of yours (whether expressed as Bracket Notation or not) CONTROLLING LOOKUP FAILURE YourProjClass->fallback_languages() If you get tired of constantly saying print $lh->maketext, consider making a functional wrapper for it, like so: "I ate [quant,_1,rhubarb pie[ " return 1 if $answer eq 'o' or $answer eq 'oui'; my($lh, @stuff) = @_; But failure_handler_auto, instead of dying or anything, compiles $key, caching it in $lh-> 'failure_lex'} $key} = $complied, and then calls the compiled value, and returns that (I e , if $key looks like bracket notation, $compiled is a sub, and we return & $compiled}(@params); but if $key is just a plain string, we just return that ) The group as a whole is interpreted as follows: sub init 'en-US', 'fr', 'kon', 'i-klingon', 'i-klingon-romanized' $lh = Projname::L10N->get_handle( ) || die "Language?"; # but after we log it for later fingerpointing Translators may request clarification of the situation in which a particular phrase is found For example, in English we are entirely happy saying "n files found", regardless of whether we mean "I looked for files, and found n of them" or the rather distinct situation of "I looked for something else (like lines in files), and along the way I saw n files " This may involve rethinking things that you thought quite clear: should "Edit" on a toolbar be a noun ("editing") or a verb ("to edit")? Is there already a conventionalized way to express that menu option, separate from the target language's normal word for "to edit"? $lh = YourProjClass->get_handle( %Lexicon = ( $lh->fail_with('failure_handler_auto'); * "_general_graphics_path" Or you may want to override it with something that traps any exceptions, if that's critical to your program: sub maketext $text = $lh->maketext(key, parameters for this phrase ); ENTRIES IN EACH LEXICON "[quant,_1,document] were matched \n" print $lh->maketext("Foobar [_1] stuff\n", $thing); my($failing_lh, $key, $params) = @_; my $lh = $_[0]; This is the most important method in Locale::Maketext: These are to do with constructing a language handle: some code here If you're using localization in an application that keeps a configuration file, you might consider something like this in your project class: An object belonging to a language class is called a "language handle"; it's typically a flyweight object * I assume that each language class derives (directly or indirectly) from your project class, and also defines its @ISA, its %Lexicon, or both But I anticipate no dire consequences if these assumptions do not hold Note that you might find it useful in some cases to override the maketext method with an "after method", if you want to translate encodings, or even scripts: print $lh->maketext("You won!"), "\n"; Currently this OS-specific stuff consists of looking in the environment variables "LANG" and "LANGUAGE"; and on MSWin machines (where those variables are typically unused), this also tries using the module Win32::Locale to get a language-tag for whatever language/locale is currently selected in the "Regional Settings" (or "International"?) Control Panel I welcome further suggestions for making this do the Right Thing under other operating systems that support localization # print LEX_FAIL_LOG scalar(localtime), "\t", But for "directory", you'd want "[quant,_1,direcory,directories]" so that our elementary quant method doesn't think that the plural of "directory" is "directorys" And you might find that the output may sound better if you specify a negative form, as in: So for English (with Bracket Notation) " [quant,_1,file] " is fine (for 0 it returns "0 files", for 1 it returns "1 file", and for more it returns "2 files", etc ) Bracket Notation is discussed in a later section Note that trying to compile a string into Bracket Notation can throw an exception if the string is not syntactically valid (say, by not balancing brackets right ) } rather than this more cryptic mess: Bracket groups that are empty, or which consist only of whitespace, are ignored (Examples: "[]", "[ ]", or a [ and a ] with returns and/or tabs and/or spaces between them use base qw(Projname::L10N); * * Also, calling &$coderef($lh, parameters ) can throw any sort of exception (if, say, code in that sub tries to divide by zero) But a very common exception occurs when you have Bracket Notation text that says to call a method "foo", but there is no such method (E g , "You have [quatn,_1,ball] " will throw an exception on trying to call $lh->quatn($_[1],'ball') -- you presumably meant "quant" ) maketext catches these exceptions, but only to make the error message more readable, at which point it rethrows the exception Now, right after you've just written the above lines, you'd normally have to go open the file ThisProject/I18N/en pm, and immediately add an entry: } else # except that we actually call numf to Create a class for the language your internal keys are in Name the class after the language-tag for that language, in lowercase, with dashes changed to underscores Assuming your project's first language is US English, you should call this Projname::L10N::en_us It should consist minimally of: my $lh = $_[0]; * Methods that you may find it handy to use, from routines of yours that you put in %Lexicon entries => "", # fill in something here, Jacques! Compare this code that uses an arbitrary ID * * Once the program is otherwise done, and once its localization for the first language works right (via the data and methods in Projname::L10N::en_us), you can get together the data for translation If your first language lexicon isn't an _AUTO lexicon, then you already have all the messages explicitly in the lexicon (or else you'd be getting exceptions thrown when you call $lh->maketext to get messages that aren't in there) But if you were (advisedly) lazy and are using an _AUTO lexicon, then you've got to make a list of all the phrases that you've so far been letting _AUTO generate for you There are very many ways to assemble such a list The most straightforward is to simply grep the source for every occurrence of "maketext" (or calls to wrappers around it, like the above pmt function), and to log the following phrase * You must have a project base class, which you load, and which you then use as the first argument in the call to YourProjClass->get_handle( ) It should derive (whether directly or indirectly) from Locale::Maketext It doesn't matter how you name this class, altho assuming this is the localization component of your Super Mega Program, good names for your project class might be SuperMegaProgram::Localization, SuperMegaProgram::L10N, SuperMegaProgram::I18N, SuperMegaProgram::International, or even SuperMegaProgram::Languages or SuperMegaProgram::Messages * I foresee no problems with having multiple inheritance in your hierarchy of language classes (As usual, however, Perl will complain bitterly if you have a cycle in the hierarchy: i e , if any class is its own ancestor ) to ThisProject/I18N/en pm, because if _AUTO is true there, then just looking for an entry with the key "Couldn't find file \"[_1]\"!\n" in that lexicon will cause it to be added, with that value! Because if _1 is one, you get "1 document were matched" An acceptable hack here is to do something like this: my $class = $_[0]; return "1 $singular"; to this code that uses a key-as-value: Note that the reason that keys that start with "_" are immune to _AUTO isn't anything generally magical about the underscore character -- I just wanted a way to have most lexicon keys be autoable, except for possibly a few, and I arbitrarily decided to use a leading underscore as a signal to distinguish those few "Foo ", * Decide what system you'll use for lexicon keys If you insist, you can use opaque IDs (if you're nostalgic for catgets), but I have better suggestions in the section "Entries in Each Lexicon", above Assuming you opt for meaningful keys that double as values (like "Minimum ([_1]) is larger than maximum ([_2])!\n"), you'll have to settle on what language those should be in For the sake of argument, I'll call this English, specifically American English, "en-US" "_backward_icon" print "Foobar $thing stuff\n"; which you'd then call in a construct like this: $Carp::Verbose = 1; instead do it thru maketext, using no variable interpolation in the key: In order to make sense of Maketext and how all its components fit together, you should probably go read Locale::Maketext::TPJ13, and then read the following documentation # stringify $number before returning it "_alert_sound" Other data worth storing in a lexicon might be things like filenames for language-targetted resources: "!", "Couldn't find file \"[_1]\"!\n" $lh->failure_handler_auto If the first item in a bracket group looks like a method name, then that group is interpreted like this: * Language classes may derive from other language classes (altho they should have "use Thatclassname" or "use base qw( classes )") They may derive from the project class They may derive from some other class altogether Or via multiple inheritance, it may derive from any mixture of these use Projname::L10N; $lh->fail_with('my_clever_failure_handler'); sub } # make a language handle from among the classes available, $min, $max literals Text in brackets is rather more complex, and currently follows join '', While you can use arbitrary unique IDs for lexicon keys (like "_min_larger_max_error"), it is often useful for if an entry's key is itself a valid value, like this example error message: rest of items in this group get_handle appends the return value of this to the end of whatever list of languages you pass get_handle Unless you override this method, your project class will inherit Locale::Maketext's fallback_languages, which currently returns ('i-default', 'en', 'en-US') ("i-default" is defined in RFC 2277) * Methods to do with constructing language handles Now, as to what you may want to do with these handlers: Maybe you'd want to log what key failed for what class, and then die Maybe you don't like die and instead you want to send the error message to STDOUT (or wherever) and then merely exit() "Minimum ([_1]) is larger than maximum ([_2])!\n", Language Handle Attributes and Internals Couldn't access datanode Stuff=[thangamabob]! returning # For the moment, assume that things are set up so Otherwise (i e , if not a CGI), this tries various OS-specific ways to get the language-tags for the current locale/language, and then pretends that those were the value(s) passed to cet_handle YourProjClass->fallback_language_classes() Or maybe you don't want to die at all! Maybe you could use a handler like this: # to be called by $lh->maketext(KEY, params ) but since you anticipate localizing this, you write: Locale::Maketext offers a variety of methods, which fall into three categories: Construction Methods $language->sprintf($format, @items) else $pod_bay_door->leave_closed() } These two methods are discussed in the section "Controlling Lookup Failure" $lh->bar('baz', $lh->quux('quuux')), # and that's the class that $lh belongs to When that string is compiled from bracket notation into a real Perl sub, it's basically turned into: print $lh->maketext("Open the pod bay door (y/n)? "); It's for quantifying a noun (i e , saying how much of it there is, while giving the currect form of it) The behavior of this method is handy for English and a few other Western European languages, and you should override it for languages where it's not suitable You can feel free to read the source, but the current implementation is basically as this pseudocode describes: $lh->init(); "!", This returns the given number formatted nicely according to this language's conventions Maketext's default method is mostly to just take the normal string form of the number (applying sprintf "%G" for only very large numbers), and then to add commas as necessary (Except that we apply tr/, / ,/ if $language-> 'numf_comma'} is true; that's a bit of a hack that's useful for languages that express two million as "2 000 000" and not as "2,000,000") '_AUTO' => 1, AUTO LEXICONS This tries loading classes based on the language-tags you give (like ("en-US", "sk", "kon", "es-MX", "ja", "i-klingon"), and for the first class that succeeds, returns YourProjClass::language->new() # Depending on the user's locale, etc , this will If get_handle senses that it's running in program that was invoked as a CGI, then it tries to get language-tags out of the environment variable "HTTP_ACCEPT_LANGUAGE", and it pretends that those were the languages passed as parameters to get_handle return; BRACKET NOTATION Note that you may have things stored in a lexicon besides just phrases for output: for example, if your program takes input from the keyboard, asking a "(Y/N)" question, you probably need to know what equivalent of "Y[es]/N[o]" is in whatever language You probably also need to know what the equivalents of the answers "y" and "n" are You can store that information in the lexicon (say, under the keys "~answer_y" and "~answer_n", and the long forms as "~answer_yes" and "~answer_no", where "~" is just an ad-hoc character meant to indicate to programmers/translators that these are not phrases for output) The effect of using "failure_auto_handler" is like an AUTO lexicon, except that it 1) compiles $key even if it starts with "_", and 2) you have a record in the new hashref $lh-> 'failure_lex'} of all the keys that have failed for this object This should avoid your program dying -- as long as your keys aren't actually invalid as bracket code, and as long as they don't try calling methods that don't exist This is just a wrapper around Perl's normal sprintf function It's provided so that you can use "sprintf" in Bracket Notation: if(-e $filename) return Chineeze::taiwan2mainland($value); eval $out = $lh->SUPER::maketext(@stuff) }; $lh = YourProjClass->get_handle( langtags ) || die "lg-handle?"; $language->quant($number, $singular) The "maketext" Method This is called by ->new to initialize newly-constructed language handles If you define an init method in your class, remember that it's usually considered a good idea to call $lh->SUPER::init in it (presumably at the beginning), so that all classes get a chance to initialize a new object however they see fit Here is a brief checklist on how to use Maketext to localize applications: "Foo [bar,baz,[quux,quuux]]\n"; You may also wish to discuss with the translators the question of how to relate different subforms of the same language tag, considering how this reacts with get_handle's treatment of these For example, if a user accepts interfaces in "en, fr", and you have interfaces available in "en-US" and "fr", what should they get? You may wish to resolve this by establishing that "en" and "en-US" are effectively synonymous, by having one class zero-derive from the other elsif $number is 1, emits the right text for this language If the object in $lh belongs to class "TkBocciBall::Localize::fr" and %TkBocciBall::Localize::fr::Lexicon contains ("You won!" => "Tu as gagn�!"), then the above code happily tells the user "Tu as gagn�!" You may also want to read over the source for File::Findgrep and its constituent modules -- they are a complete (if small) example application that uses Maketext if $number is 0 and there's a $negative, } my $lh_backup = ThisProject->get_handle('en'); you clever things here * You may at this point want to consider whether the your base class (Projname::L10N) that all lexicons inherit from (Projname::L10N::en, Projname::L10N::es, etc ) should be an _AUTO lexicon It may be true that in theory, all needed messages will be in each language class; but in the presumably unlikely or "impossible" case of lookup failure, you should consider whether your program should throw an exception, emit text in English (or whatever your project's first language is), or some more complex solution as described in the section "Controlling Lookup Failure", above $language->encoding() For example, here all the areas that are taken literally are underlined with a "^", and all the in-bracket special regions are underlined with an X: Also, once a project is otherwise complete and you start to localize it, you can scrape together all the various keys you use, and pass it to a translator; and then the translator's work will go faster if what he's presented is this: But for other languages (as is discussed at length in Locale::Maketext::TPJ13), simple quant/numerify is not enough For the particularly problematic Slavic languages, what you may need is a method which you provide with the number, the citation form of the noun to quantify, and the case and gender that the sentence's syntax projects onto that noun slot The method would then be responsible for determining what grammatical number that numeral projects onto its noun phrase, and what case and gender it may override the normal case and gender with; and then it would look up the noun in a lexicon providing all needed inflected forms Currently this just takes the last bit of ref($language), turns underscores to dashes, and returns it So if $language is an object of class Hee::HOO::Haw::en_us, $language->language_tag() returns "en-us" (Yes, the usual representation for that language tag is "en-US", but case is never considered meaningful in language-tag comparison ) return "$number " $singular "s"; "Minimum ([_1]) is larger than maximum ([_2])!\n", } } # Make all lookups fall back onto an English value, Some users have expressed that they think this whole mechanism of having a "fail" attribute at all, seems a rather pointless complication But I want Locale::Maketext to be usable for software projects of any scale and type; and different software projects have different ideas of what the right thing is to do in failure conditions I could simply say that failure always throws an exception, and that if you want to be careful, you'll just have to wrap every call to $lh->maketext in an eval } However, I want programmers to reserve the right (via the "fail" attribute) to treat lookup failure as something other than an exception of the same level of severity as a config file being unreadable, or some essential resource being inaccessable my $answer = lc $_[1]; # smash case $language->quant($number, $singular, $plural) if(-e $filename) # BACKwards, and right is FOREwards => "", # fill in something here, Jacques my $self = shift(@_); The basic design of Locale::Maketext is object-oriented, and Locale::Maketext is an abstract base class, from which you derive a "project class" The project class (with a name like "TkBocciBall::Localize", which you then use in your module) is in turn the base class for all the "language classes" for your project (with names "TkBocciBall::Localize::it", "TkBocciBall::Localize::en", "TkBocciBall::Localize::fr", etc ) # so if maketext fails, we see made the call to pmt sub lex_fail * $lh->foo( $_[1], "bar", "baz"), "Your search matched [quant,_1,document]!" * Otherwise this bracket group is invalid For example, in the group "[!@#,whatever]", the first item "!@#" is neither empty-string, "_number", "_-number", "_*", nor a valid method name; and so Locale::Maketext will throw an exception of you try compiling an expression containing this bracket group * rest of items in this group my $lh = ThisProject::I18N->get_handle(); } # Simply read: Besides whole phrases meant for output, anything language-dependent should be put into the class Projname::L10N::en_us, whether as methods, or as lexicon entries -- this is discussed in the section "Entries in Each Lexicon", above } $lh->that_method_name( EOSTUFF my $lh = $_[0]; But it actually compiles as this: until(defined $response) => "Couldn't find file \"[_1]\"!\n", * Or write the "bar" method so you don't need to pass it the output from calling quux Brackets must be balanced -- every openbracket must have one matching closebracket, and vice versa So these are all invalid: $lh = TkBocciBall::Localize->get_handle(); # Config file missing, maybe? use TkBocciBall::Localize; # the localization project class print $lh->maketext( And on the off chance you need a literal tilde in a bracket expression, you get it with "~~" die $lh->maketext( "_min_larger_max_error", $min, $max ) * An item that is "_digits" or "_-digits" is interpreted as $_[value] I e , "_1" is becomes with $_[1], and "_-3" is interpreted as $_[-3] (in which case @_ should have at least three elements in it) Note that $_[0] is the language handle, and is typically not named directly A language handle is implemented as a blessed hash Subclasses of yours can store whatever data you want in the hash Currently the only hash entry used by any crucial Maketext method is "fail", so feel free to use anything else as you like if($response) $pod_bay_door->open() } my $lh = Projname::L10N->get_handle( ) || die "Language?"; my $value = $self->maketext(@_); ), ") is larger than maximum (", sub It is a common feature of applications (whether run directly, or via the Web) for them to be "localized" -- i e , for them to a present an English interface to an English-speaker, a German interface to a German-speaker, and so on for all languages it's programmed with Locale::Maketext is a framework for software localization; it provides you with the tools for organizing and accessing the bits of text and text-processing code that you need for producing localized applications $lh->foo(" _1 ", " bar ", "baz"), #!!! "[quant,_1,document was, documents were] matched \n" "some_key" => sub # And, assuming you want the base class to be an _AUTO lexicon, open(LEX_FAIL_LOG, ">>wherever/lex log") || die "GNAARGH $!"; get_handle appends the return value of this to the end of the list of classes it will try using Unless you override this method, your project class will inherit Locale::Maketext's fallback_language_classes, which currently returns an empty list, () By setting this to some value (namely, the name of a loadable language class), you can be sure that get_handle will always manage to construct a language handle This looks in the %Lexicon of the language handle $lh and all its superclasses, looking for an entry whose key is the string key Assuming such an entry is found, various things then happen, depending on the value found: Currently this isn't used for anything, but it's provided (with default value of (ref($language) && $language-> 'encoding'})) or "iso-8859-1" ) as a sort of suggestion that it may be useful/necessary to associate encodings with your language handles (whether on a per-class or even per-handle basis ) "_min_larger_max_error" "Hoohah ", # as is discussed a few sections up: "Hoohah ", You might want to do the same thing for expressing key bindings or the like (since hardwiring "q" as the binding for the function that quits a screen/menu/program is useful only if your language happens to associate "q" with "quit"!) $lh->fail_with( undef ); # In some other languages, left equals %Lexicon = ( $response = $lh->y_or_n( get_input_from_keyboard_somehow() ); sub my_clever_failure_handler return $negative; You may override this as you like; Maketext doesn't use it for anything ) if $min > $max; return join '', HOW TO USE MAKETEXT use base ('YrProj::zh_tw'); # Taiwan-style "Minimum (", return 0 if $answer eq 'n' or $answer eq 'non'; "_forward_icon" ref($failing_lh), "\t", $key, "\n"; This method (by having it return the name of a language-tag that has an existing language class) can be used for making sure that get_handle will always manage to construct a language handle (assuming your language classes are in an appropriate @INC directory) Or you can use the next method: # Set to a coderef: * use base qw(Locale::Maketext); package Projname::L10N; die "Couldn't make a language handle??" unless $lh; (This is meant to be somewhat like the AUTOLOAD mechanism in Perl's function call system -- or, looked at another way, like the AutoLoader module )

ATTN:Medical_Billing_Training Online_Courses are Available !!

#sionligh.com/grd.php?r-Nzg3MDQxYyFkOHA0MnBmMHA0YiExNzk0ITNlOSFwYWQwMXxnbSFtZGhlYWx0aHUxZ21mcmohN2RhdDZ0MTgh

>> Quick and_easy Form
>> Search and_compare Programs
>> Choose the one of the_best for You
>> Inquire About_Financial_Aid

Certified Coders_Earn:_Usd30-35K

ActNow To get_Started on Your_Traning in_medical_coding

#sionligh.com/grd.php?r-Nzg3MDQxYyFkOHA0MnBmMHA0YiExNzk0ITNlOSFwYWQwMXxnbSFtZGhlYWx0aHUxZ21mcmohN2RhdDZ0MTgh





Unsubscribe_From_Sponsor:
#sionligh.com/ard.php?uu-Nzg3MDQxYyFkOHA0MnBmMHA0YiExNzk0ITNlOSFwYWQwMXxnbSFtZGhlYWx0aHUxZ21mcmohN2RhdDZ0MTgh
orWriteto Healthcare-Colleges,157 Yesler_Way_Suite 200,Seattle,WA_98104


Unsubscribe-From_Mailing:
#sionligh.com/ard.php?ui-Nzg3MDQxYyFkOHA0MnBmMHA0YiExNzk0ITNlOSFwYWQwMXxnbSFtZGhlYWx0aHUxZ21mcmohN2RhdDZ0MTgh
Write to pobox 137 1648 S_Ohio Salina KS-67401US