Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: multi-lingual support...

by mirod (Canon)
on Jan 05, 2002 at 01:13 UTC ( #136384=note: print w/ replies, xml ) Need Help??


in reply to multi-lingual support...

Here is a rough French translation. It is not great as my technical French is getting quite poor as I use mostly English these days ;--( and as I don't use any French software.

As a general comment I am afraid you are being a little too clever here. The order of words in a sentence vary between languages, and it is very difficult, if not right down impossible, to generate sentences from bits and pieces like you do. Usually if you want your software to be easily ported to other languages each message (or at least each sentence) has to be a separate string. A common trickis to use sprintf in order not to depend on the original English order:

"$format config copied to $tftpserver from $args->{h} by $user\n"

becomes:

sprintf "config copied to %s from %s by %s\n", $tftpserver, $args->{h}, $user;

(note that $args->{h} will not be interpolated properly in the string by the way)

And in French:

sprintf "configuration de %s copiée sur %s par %s\n", $tftpserver, $args->{h}, $user;

Note that if you want to be able to change the order of parameters you will need to add yet an other indirection layer, for example the message could be stored as "configuration de $par{server} copiée sur $par{target} par $par{user}\n" and the output being done by a sub that gets passed the parameters as a hash.

Anyway, here is the translation, which will certainly be corrected by other Mongueurs.

$lang{flag_req} = "Pancho: Options manquantes" $lang{run_help} = "Entrer $0 --help"; $lang{no_open} = "Impossible d'ouvrir le fichier spé +cifié par --li"; $lang{chk_path} = "Veuilliez vérifier le chemin et l' +existence du fichier"; # I don't know if 'noeud' is the proper translation for 'node +' here $lang{no_nodes} = "Vous n'avez pas spécifié un noeud +ou une liste de noeuds cible"; $lang{no_snmp} = "Vous n'avez pas spécifié une commu +nauté SNMP."; $lang{no_tftp} = "Vous n'avez pas spécifié un serveu +r tftp."; # The adjective comes after the noum in French, so you can't +have a hanging 'remote' $lang{exp_tftp} = "Pour tftp une configuration"; $lang{no_file} = "Vous devez spécifier un nom de fic +hier avec l'option -f"; # 'telecharger' means both upload and downlod in French :--( $lang{no_updown} = "Impossible d'uploader et de telech +arger en meme temps"; $lang{version} = "Pancho version"; $lang{no_log} = "Impossible d'ouvrir le fichier log +"; $lang{exp_path} = "Veuillez vérifier le chemin"; # we're starting to hit problems here, the syntax does not ma +tch $lang{copy_start} = "Copie de la configuration de et ve +rs startup-c"; $lang{no_catos} = "impossible avec CatOS."; $lang{no_depmib} = "impossible avec mibs (obsoléte)."; + # it should be a e` (è here) $lang{cp_success} = "Copie effectuée vers"; # this rarely works $lang{on} = "sur"; $lang{from} = "de"; $lang{to} = "vers"; $lang{by} = "par"; $lang{cp_from} = "copié de"; $lang{cp_to} = "copié vers"; $lang{to_nvram} = "vers nvram sur"; $lang{cp_nvram} = "copié vers nvram sur"; $lang{from_nvram} = "de nvram sur"; $lang{wr_success} = "Configuration chargée en memoire s +ur"; # it's hard to fit the originalwording in a French sentence $lang{rel_success} = "Rechargement des parametres de"; $lang{init} = "initialisation du rechargement sur +";


Comment on Re: multi-lingual support...
Select or Download Code
Re: Re: multi-lingual support...
by wog (Curate) on Jan 05, 2002 at 03:44 UTC
    Note that if you want to be able to change the order of parameters you will need to add yet an other indirection layer...

    update: Okay... I should check docs less recent then the latest development version. Read this as "you won't have to in the next version of perl".

    Actually, you won't. To quote the sprintf docs:

    Perl supports parameter ordering, in other words, fetching the parameters in some explicitly speci fied "random" ordering as opposed to the default implicit sequential ordering. The syntax is, instead of the "%" and "*", to use "%"digits"$" and "*"digits"$", where the digits is the wanted index, from one upwards. For example:
    printf "%2\$d %1\$d\n", 12, 34; # will print "34 12\n" printf "%*2\$d\n", 12, 3; # will print " 12\n"
    (... more stuff on this topic omitted ...)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://136384]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (16)
As of 2014-07-31 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (251 votes), past polls