t12s: translate 1 script to several languages

This is for Developers of shell scripts and Translators

Purpose
 What is wrong with gettext?
t12s Overview
Steps using t12s
 Preparation (Developers only)
 yad
 t12s select 1 script
 t12s translate script>
 t12s translate script to language
 t12s ´Execute´ button
 t12s ´Change Language´ button
Summary
Thanks

Purpose

Having used GNU/gettext in shell scripts for a while it is time now to find a better solution.

What is wrong with gettext?

Nothing is wrong.
But using it in shell scripts is slow.
How slow? Test yourself:
time echo "hello world"
time echo $(gettext "hello world")

Speed of execution is becoming important again because we want to use our favourite operation system not only in so called old hardware but also in upcoming new cheap and low powered boxes like Raspberry Pi.
GNU/gettext has a really wonderful manual and making further use of gettext in BaCon is much appreciated!.

t12s Overview

Just for shell scripts.
Note: There is no equivalent for eval_ngettext (which has never been used with Puppy)

 Original Shell Script ─> Preparation ─> Marked Shell Script ─╮
                                                              │
                 ╭─────────<─── (yad) 	                      │
   ╭─── t12s <───┤                                            │
   │             ╰─────────<──────────────────────────────────╯
   │                                            
   ╰─>TEXTDOMAINDIR/script─>execute Marked Shell Script─>─╮
                                                          │
                                     "Hello world!" <─────╯

Steps using t12s

Preparation (Developers only)

Note1, x12s will automatically identify all marked messages and change every _M_ to _M_n where n is the number that identifies each of the different messages.
Note2, There is no portable object template (script.pot) in x12s. The original English messages are always dynamicly recreated.
Note3, if you ever must change the meaning of a message then do not just change the message because the previous meaning has been translated and is stored nowhere! Instead just mark it new _M_:- , that is delete the number. If it is just a typo then just correct it because existing translations use _M_number.

yad

Yad is Yet another dialog and my preferred tool for coding simple GUIs like t12s. In Puppy, if not pre-installed it is found in the repository: puppy-common.
Note, yad is required for developing and translation only. Running the localized script is possible without yad.

t12s select 1 script

Running t12s the first dialog is asking for the script which you want to translate. You can circumvent this by invoking t12s to gether with script. Example: # t12s /usr/sbin/askpass will circumvent the dialog asking for the script and take /usr/sbin/askpass immediately.
If markers _M_: are found in the selected script then the above mentioned identifying takes place. You can start with some messages and add others later, any _M_ without a number will always be found by t12s.
In some cases (\"...\") the identifying number cannot be automatically inserted into the script but you will be guided how to do it manually.

t12s translate script

Here the target language is chosen. You can return to this dialog later and choose another language.

Developers can choose pseudo language xxx, this just adds some XXX to every message simulating larger strings.

Thus they can check their work on completeness and breaking of design.
Skip ´t12s translate script to language´

t12s translate script to language

Translated messages or if not yet available the original English messages are displayed here and the translation can be edited one by one message.

NOTE: variables, that is any $..... must stay unchanged! Please make sure they are unchanged, if not then use the ´Undo´ button.

Technosaurus´ method for automated translation as a start for human translations is still work in progress.
Problems:
not every charset to convert from to utf8 is known.
Sometimes a translation is not useable caused by a broken syntax.
Messages that contain more than one variable have to be excluded because sometimes names of variables are translated too.

t12s ´Execute´ button

The ´Execute´ button lets immediately start the script in the chosen language.

t12s ´Change Language´ button

The ´Change Language´ button lets you continue translation of the same script to another language.

Summary

t12s is simple and fast in both creation and execution of localized shell scripts. There is no equivalent for eval_ngettext (handling of plurals). There is yet no equivalent for poedit. If there is a need for further documentation let me know.


Have fun L18L 2011-11-28

Special thanks to Technosaurus for his core algorithmus published in localizing shell scripts without bashism, gettext or ... anything.
And a big thank you also to our multi-language translator and software tester ferro10n.
Thanks to 01micko, his coding style caused some improvements.
Thanks to BarryK, who made it possible and to Mrs. L18L, who permitted it.

Last update: 2012-01-04