[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Verschillen

Dit geeft de verschillen weer tussen de geselecteerde revisie en de huidige revisie van de pagina.

Link naar deze vergelijking

Volgende revisie
Vorige revisie
nl:howtos:misc:internationalization_and_localization_of_shell_scripts [2014/12/28 22:53 (UTC)] – Nederlandse vertaling begonnen. alienbobnl:howtos:misc:internationalization_and_localization_of_shell_scripts [2015/06/22 11:33 (UTC)] (huidige) – [Practische aanbevelingen voor vertalers] vertaald. alienbob
Regel 1: Regel 1:
-=====Internationalisatie and localisatie van shell scripts=====+=====Internationalisatie en localisatie van shell scripts=====
  
 ====Presentatie==== ====Presentatie====
Regel 9: Regel 9:
 Het referentiedocument is de handleiding getiteld [[http://www.gnu.org/software/gettext/manual/gettext.html|GNU `gettext' utilities]]. Het referentiedocument is de handleiding getiteld [[http://www.gnu.org/software/gettext/manual/gettext.html|GNU `gettext' utilities]].
  
-De handleiding omvat alle programmeertalen die bruikbaar zijn met gettext, met een speciale focus op de taal 'C'.+De handleiding behandelt alle programmeertalen die bruikbaar zijn met gettext, met een speciale focus op de taal 'C'.
  
 De [[http://pubs.opengroup.org/onlinepubs/009695399/nframe.html|POSIX specificatie]] is aanbevolen leesvoer, met name de volumes [[http://pubs.opengroup.org/onlinepubs/009695399/basedefs/contents.html|Basis Definities]] en [[http://pubs.opengroup.org/onlinepubs/009695399/utilities/contents.html|Shell en Gereedschappen]]. De [[http://pubs.opengroup.org/onlinepubs/009695399/nframe.html|POSIX specificatie]] is aanbevolen leesvoer, met name de volumes [[http://pubs.opengroup.org/onlinepubs/009695399/basedefs/contents.html|Basis Definities]] en [[http://pubs.opengroup.org/onlinepubs/009695399/utilities/contents.html|Shell en Gereedschappen]].
  
-In contrast met de handleiding is de reikwijdte van het onderhavige document beperkt tot shell scripts.+In contrast met de handleiding blijft de reikwijdte van het onderhavige document beperkt tot shell scripts.
  
 === Theorie van de operatie === === Theorie van de operatie ===
Regel 27: Regel 27:
 Een berichten sjabloon-catalogus wordt gewoonlijk een "Portable Object Template" of POT bestand genoemd. Een berichten sjabloon-catalogus wordt gewoonlijk een "Portable Object Template" of POT bestand genoemd.
  
-Een POT bestand, leesbare platte tekst, bestaat voornamelijk uit de geëxtraheerde tekst-reeksen, vooraf gegaan door "msgid" wat zoveel betekent als "message identifier", waatbij elk weer wordt gevolgd door een vertaling van dat bericht, dat wordt vooraf gegaan door de tekst "msgstr".+Een POT bestand, leesbare platte tekst, bestaat voornamelijk uit de geëxtraheerde tekst-reeksen, vooraf gegaan door "msgid" wat zoveel betekent als "message identifier". Bij elke "msgid" tekst behoort een vertaling van dat bericht, en deze tekst-reeks wordt vooraf gegaan door het woord "msgstr" wat staat voor "message string".
  
 Het **Localisatie** proces (verkort tot L10N) bestaat uit: Het **Localisatie** proces (verkort tot L10N) bestaat uit:
Regel 33: Regel 33:
   * alle "msgstr" teksten voorzien van vertalingen in ieder PO bestand,   * alle "msgstr" teksten voorzien van vertalingen in ieder PO bestand,
   * deze PO bestanden controleren/verifiëren na de vertaalslag,   * deze PO bestanden controleren/verifiëren na de vertaalslag,
-  * ieder PO bestand individueel compileren tot een "Machine Objet" of MO bestand.+  * ieder PO bestand individueel compileren tot een "Machine Object" of MO bestand.
    
-De MO bestanden die bedoeld zijn voor de machine, niet de mensvandaar de naamworden traditioneel opgeslagen als:+De MO bestanden die bedoeld zijn voor de machine, niet de mens (vandaar de naamworden traditioneel opgeslagen als:
   /usr/share/locale/<locale>/LC_MESSAGES/<software naam>.mo   /usr/share/locale/<locale>/LC_MESSAGES/<software naam>.mo
  
-In het bovenstaande pad is <locale> een //locale// code in de vorm <ll[_TT], waar ll de twee-letterige code is van de doel-taal zoals gedefinieerd in de ISO 639-1 standaard, en TT (indien aanwezig) is de twee-letterige land-code van deze locale zoals gedefinieerd in ISO 3166.+In het bovenstaande pad is <locale> een //locale// code in de vorm <tt[_LL]>, waar tt de twee-letterige code is van de doel-taal zoals gedefinieerd in de ISO 639-1 standaard, en LL (indien aanwezig) is de twee-letterige land-code van deze locale zoals gedefinieerd in ISO 3166.
  
 Ieder gemarkeerd script moet het volgende commando bevatten: Ieder gemarkeerd script moet het volgende commando bevatten:
   export TEXTDOMAIN=<software naam>   export TEXTDOMAIN=<software naam>
  
-Tijdens het uitvoeren van het script stelt dat 'gettext' in staat om het juiste MO bestand te vinden en iedere gemarkeerde bericht-tekst weer te geven in de voorkeurstaal zoals die door de LANG of LANGUAGE omgevings-variabele is bepaald. +Tijdens het uitvoeren van het script wordt zo 'gettext' in staat gesteld om het juiste MO bestand te vinden en iedere gemarkeerde bericht-tekst weer te geven in de voorkeurstaal zoals die door de LANG of LANGUAGE omgevings-variabele is bepaald.
  
 ==== Procesdiagrammen ==== ==== Procesdiagrammen ====
  
-Let's assume that a given software comprises a set of shell scripts that we want to internationalize and localize.+Laten we aannemen dat een bepaalde software bestaat uit een verzameling shell scripts die we willen internationaliseren en localiseren.
  
-Following diagrams give an overview of each of the involved processesinternationalizationlocalizationusage and maintenance.+De onderstaande diagrammen tonen een overzicht van iedere fase van de betrokken processeninternationalisatielocalisatiegebruik en onderhoud.
  
-These diagrams are hybridi.e. they exhibit data as well as actions.+Deze diagrammen zijn hybridedwz ze tonen data zowel als acties.
  
-Among these actions are execution of some programs of the gettext suite+Onder deze acties vallen de uitvoering van een aantal programma's uit de ''gettext'' verzameling
-  * gettetxt: marks strings to be insternationalizedthen displays localized messages during scripts' execution +  * ''gettetxt''markeert de te internationaliseren tekstreeksenen toont later de gelocaliseerde berichten tijdens de uitvoering van het script 
-  * xgettext: extracts marked strings from a set of shell scripts to build a POT or a PO file +  * ''xgettext''extraheert de gemarkeerde tekstreeksen uit een verzameling shell scripts om er een //POT// of een //PO// bestand van op te bouwen 
-  * msgcmp:   checks a PO file against another PO or a POT file for consistency +  * ''msgcmp'':   controleert een PO bestand op consistentie aan de hand van een ander PO of POT bestand 
-  * msginit:  write a PO file using a POT file as its input    +  * ''msginit'':  schrijft een PO bestand met een POT bestand als de input    
-  * msgfmt:   format a MO file using a POI file as its input +  * ''msgfmt'':   genereert een MO bestand met een POT bestand als de input 
-  * msgmerge: merge or update PO or POT files+  * ''msgmerge''samenvoegen of wijzigen van PO of POT bestanden
  
-In below diagrams gettext programs are surrounded by square brackets.+In onderstaande diagrammen worden de ''gettext'' programma's omgeven door vierkante haken.
  
-=== (1) Internationalization ===+=== (1) Internationalisatie ===
    
  
-   Set of shell scripts ───> Preparation ───> Marked shell scripts ───╮ +   Verzameling shell scripts ───> Preparatie ───> Gemarkeerde shell scripts ───╮ 
-                                                                      │ +                                                                               │ 
-            ╭──────────────<── software.pot <─── [xgettext] <─────────╯+            ╭──────────────<── software.pot <─── [xgettext] <──────────────────╯
             │             │
-            ├────> (2) Localization+            ├────> (2) Localisatie
             │             │
-            ╰────> (4) Maintenance+            ╰────> (4) Onderhoud
  
  
-=== (2) Localization (example for French and Dutch languages). ===+=== (2) Localisatie (voorbeeld met Frans en Nederlands als talen). ===
  
  
-       ╭──────────────<── software.pot <── (1) Internationalization+       ╭──────────────<── software.pot <── (1) Internationalisatie
        │        │
        │        │
        ├──> [msginit] ──> fr_FR.po ──> PO editor ──> fr_FR.po ──> [msgcmp] ──╮        ├──> [msginit] ──> fr_FR.po ──> PO editor ──> fr_FR.po ──> [msgcmp] ──╮
        │                                                                     │        │                                                                     │
-       │   ╭─ installation <── fr_FR.mo <── [msgfmt] <─┬─ fr_FR.po checked <─╯ +       │   ╭─ installatie <── fr_FR.mo <── [msgfmt] <─┬─ fr_FR.po controle <─╯ 
-       │   │                                           │ +       │   │                                          │ 
-       │   │                                           ╰────> (4) Maintenance+       │   │                                          ╰────> (4) Onderhoud
        │   │        │   │
-       │   ╰──> /usr/share/locale/fr_FR/LC_MESSAGES/software.mo ─> (3) Usage+       │   ╰──> /usr/share/locale/fr_FR/LC_MESSAGES/software.mo ─> (3) Gebruik
        │        │
        ╰──> [msginit] ──> nl_NL.po ──> PO editor ──> nl_NL.po ──> [msgcmp] ──╮        ╰──> [msginit] ──> nl_NL.po ──> PO editor ──> nl_NL.po ──> [msgcmp] ──╮
                                                                              │                                                                              │
-           ╭─ installation <── nl_NL.mo <── [msgfmt] <─┬─ nl_NL.po checked <─╯ +           ╭─ installatie <── nl_NL.mo <── [msgfmt] <─┬─ nl_NL.po controle <─╯ 
-           │                                           │ +           │                                          │ 
-           │                                           ╰────> (4) Maintenance+           │                                          ╰────> (4) Onderhoud
            │            │
-           ╰───> /usr/share/locale/nl_NL/LC_MESSAGES/software.mo ─> (3) Usage+           ╰───> /usr/share/locale/nl_NL/LC_MESSAGES/software.mo ─> (3) Gebruik
  
  
 +=== (3) Gebruik ===
  
-=== (3) Usage === +Veronderstel dat een van de scripts, "''myscript.sh''het volgende commando bevat:
- +
-Let's assume that one of the scripts, "myscript.sh" includes following command:+
    gettext "Good morning"    gettext "Good morning"
  
-and that "Good morning" is translated as follows in the message catalogs:+en dat "Good morning" als volgt vertaald is in de berichten catalogi:
    /usr/share/locale/fr_FR/LC_MESSAGES/PACKAGE.mo ─> "Bonjour"    /usr/share/locale/fr_FR/LC_MESSAGES/PACKAGE.mo ─> "Bonjour"
    /usr/share/locale/nl/LC_MESSAGES/PACKAGE.mo ─> "Goedemorgen"    /usr/share/locale/nl/LC_MESSAGES/PACKAGE.mo ─> "Goedemorgen"
  
-Here is what user will see depending on LANG setting+Hier is wat de gebruiker zal zien afhankelijk van de instelling van de LANG omgevingsvariabele
  
-              ╭──────────────<── (2) Localization+              ╭──────────────<── (2) Localisatie
               │               │
-   LANG=fr_FR ├───> sh myscript.sh or ./myscript.sh ───> "Bonjour"+   LANG=fr_FR ├───> sh myscript.sh of ./myscript.sh ───> "Bonjour"
               │               │
-   LANG=nl_NL ╰───> sh myscript.sh or ./myscript.sh ───> "Goedemorgen"+   LANG=nl_NL ╰───> sh myscript.sh of ./myscript.sh ───> "Goedemorgen"
                        
  
 +=== (4) Onderhoud ===
  
-=== (4) Maintenance ===+Het onderhoudsproces kan worden gestart door het creëren, wijzigen of verwijderen van een script.
  
-Maintenance process can be triggered by a script's creation, modification or deletion.+In onderstaand diagram moet het onderdeel van het proces dat begint met het '''msmerge''' commando herhaald worden voor ieder beschikbaar PO bestand.
  
-In the diagram below, the part of the process beginning with the msmerge command should be repeated for each available PO file.+Het is daarom aan te raden om een actuele lijst bij te houden van alle beschikbare vertalingen in de vorm van PO bestanden.
  
-It is therefore advisable to keep an up to date list of available translations in the form of PO files. +        Shell scripts gewijzigd en gemarkeerd ───> [xgettext] ───> software.pot ──╮ 
- +                                                                                  │ 
-        Shell scripts updated and marked ───> [xgettext] ───> software.pot ──╮ +                                     (1) Localisatie ──> <locale>.po ───>┬<──────╯
-                                                                             │ +
-                                     (1) Localization ──> <locale>.po ───>┬<─╯+
                                                                           │                                                                           │
   ╭─ [msgcmp] <── <locale>.po <─ PO editor <── <locale>.po <─ [msmerge] <─╯   ╭─ [msgcmp] <── <locale>.po <─ PO editor <── <locale>.po <─ [msmerge] <─╯
   │   │
-  ╰──> <locale>.po checked ─> [msgfmt] ─> <locale>.mo ─> installation  ────╮+  ╰──> <locale>.po controle ─> [msgfmt] ─> <locale>.mo ─> installatie  ────╮
                                                                            │                                                                            │
                     /usr/share/locale/<locale>/LC_MESSAGES/software.mo <───╯                     /usr/share/locale/<locale>/LC_MESSAGES/software.mo <───╯
                                            
-                             +Het onderhoudsproces kan ook gestart worden door een wijziging van een berichten catalogus voor een specifieke taal (om bijvoorbeeld een fout te corrigeren).
-Maintenance process can be triggered as well by a modification of a messages catalog for a specific language (to correct an error for instance).+
  
-This variant of the process is shorter:+Deze variant van het proces is korter:
        
-  ╭─ [msgcmp] <── <locale>.po <── PO editor <── <locale>.po <── Update needed+  ╭─ [msgcmp] <── <locale>.po <── PO editor <── <locale>.po <── Wijziging gewenst
   │   │
-  ╰─> <locale>.po checked ──> [msgfmt] ──> <locale>.mo ──> installation  ──╮+  ╰─> <locale>.po controle ──> [msgfmt] ──> <locale>.mo ──> installatie  ──╮
                                                                            │                                                                            │
                      /usr/share/locale/<locale>/LC_MESSAGES/software.mo <──╯                      /usr/share/locale/<locale>/LC_MESSAGES/software.mo <──╯
  
  
-==== Internationalization process ====+==== Internationalisatie proces ====
  
-This chapter is intended for developers and maintainers.+Deze paragraaf is bedoeld voor ontwikkelaars en maintainers.
  
-The internationalization process comprises following tasks+Het internationalisatie proces omvat de volgende taken
-  - Prepare scripts for internationalization +  - Bereid scripts voor op internationalisatie 
-  - Mark messages to be localized +  - Markeer de tekstberichten die gelocalizeerd moeten worden 
-  - Use 'xgettext' to produce a template catalog of messages+  - Gebruik '''xgettext''' om een sjabloon catalogus van de tekstberichten te produceren
  
-=== Prepare scripts for internationalization ===+=== Scripts ter internationalisatie voorbereiden ===
  
-This task is needed for shell scripts that do not yet fulfill requirements for internationalization.+Deze taak is nodig voor shell scripts die nog niet aan de voorwaarden voldoen voor internationalisatie.
  
-== Technical note: Gettext's requirements for shell scripts. ==+== Technische notitie: Gettext vereisten voor shell scripts. ==
  
-The list of requirements below is not complete.+Onderstaande opsomming van vereisten is niet compleet.
  
-It includes only the main ones that I recommend the developer or maintainer to checkbased on my experience.+Het noemt enkel de voornaamste die de ontwikkelaar of maintainer aangeraden wordengebaseerd op de auteur's eigen ervaringen.
  
-Gettext replaces at run time text strings output of+Gettext vervangt tijdens de uitvoering van het script (dwz 'runtime') tekstberichten die bijvoorbeeld worden uitgestuurd door
-  * an "echo" command or +  * Een "echo" commando of 
-  * a program (like 'dialog', for instance+  * een programma (zoals '''dialog''' bijvoorbeeld
-with translated text strings (found in a messages catalog for the language set by $LANG or $LANGUAGE)+met vertaalde tekst (die gevonden wordt in de berichten catalogus voor de taal die middels $LANG of $LANGUAGE ingesteld is)
  
-But the replacement only occurs if following conditions are fulfilled+Maar deze vervanging vindt alleen plaats wanneer aan de volgende voorwaarden voldaan is
-  * MO file is available in the path computed from the TEXTDOMAIN environment variable as <dir_name>/<locale>/LC_MESSAGES/text_domain.mo.\\ For instanceif TEXTDOMAIN=software and $LANG=de_DE.utf8, gettext will look for: <dir_name>/de_DE/LC_MESSAGES/software.mo\\  <dir_namecan be set through the value of the TEXTDOMAINDIR environment variableotherwise a default value is used.\\ In Slackware Linux for instance, the default value is /usr/share/locale.\\ There are fall backs, for instance if <locale> is "de_DE"  the mo file could be placed in <dir_name>/de/LC_MESSAGES/ instead of <dir_name>/de_DE/LC_MESSAGES/ +  * Een MO bestand is aanwezig in het pad dat samengesteld wordt uit de TEXTDOMAIN omgevingsvariabele tot <directorynaam>/<locale>/LC_MESSAGES/text_domain.mo.\\ Om een voorbeeld te gevenals TEXTDOMAIN=software en $LANG=de_DE.utf8, dan zal ''gettext'' zoeken naar: <directorynaam>/de_DE/LC_MESSAGES/software.mo\\  <directorynaamkan worden ingesteld door de waarde van de TEXTDOMAINDIR omgevingsvariabeleen anders wordt een standaardwaarde gebruikt.\\ In Slackware Linux bijvoornbeeld is de standaard waarde ''/usr/share/locale''.\\ Er zijn ook alternatieve lokaties: bijvoorbeeld als <locale> gelijk is aan "de_DE" dan kan het MO bestand ook worden geplaatst in <directorynaam>/de/LC_MESSAGES/ in plaats van <directorynaam>/de_DE/LC_MESSAGES/ 
-  * TEXTDOMAIN variable is exported before any *gettext command occurs.  +  * TEXTDOMAIN variabele wordt geëxporteerd, voordat enig ''*gettext'' commando wordt uitgevoerd.  
-  * gettext.sh, which provides the eval_gettext and eval_ngettext functionsis sourced before any occurrence of one of these functions+  * ''gettext.sh''dat de functies ''eval_gettext'' en ''eval_ngettext'' aanbiedtwordt ge'//source//'d voor de eerste aanroep van een van deze functies
-  * msgid string in the MO file matches exactly the argument of gettext (or eval_gettext if the text string includes a parameter expansion). +  * Een "msgid" tekstreeks in het MO bestand past exact bij het argument voor ''gettext'' (of ''eval_gettext'' als de tekstreeks een parameter expansie bevat). 
-  * The corresponding msgstr string does not include a backslash followed by a white space+  * De corresponderende "msgstr" tekstreeks bevat geen backslash die gevolgd wordt door een spatie
-  * The msgstr string begins and ends with a newline or not, as the msgid   does+  * De "msgstr" tekstreeks string begint en eindigt met een newline - of niet - precies zoals de "msgid" het doet
-  * If the text string includes a parameter expansion, eval_gettext is used instead of gettext. +  * Indien de tekstreeks een parameter expansie bevatmoet ''eval_gettext'' worden gebruikt in plaats van ''gettext''
-  * "The variable names must consist solely of alphanumeric or underscore  ASCII charactersnot start with a digit and be nonemptyotherwise such a variable reference is ignored." (gettext manual+  * "De variabele namen moeten enkel bestaan uit alfanumerieke of underscore ASCII karaktersniet starten met een cijfer en niet leeg zijnanders wordt zo een variabele referentie genegeerd." (gettext handleiding
-  * Parameter expansions are escaped with a single backslash like this:\\ \$parameter or \${parameter}\\ unless the eval_gettext command be inside a  command substitution like this:\\ "`eval_gettext "..."`" or   "$(eval_gettext "...")"\\ In the latter case, three backslashes are needed like this:\\ \\\$parameter or \\\${parameter}. +  * Parameter expansies worden escaped met een enkele backslash zoals dit:\\ \$parameter of \${parameter}\\ tenzij de ''eval_gettext'' aanroep zich bevindt binnen een commando substitutie zoals dit:\\ "`eval_gettext "..."`" of  "$(eval_gettext "...")"\\ In het laatste geval zijn drie backslashes noodzakelijk zoals dit:\\ \\\$parameter of \\\${parameter}. 
-  * Only the forms $parameter and ${parameter} of parameter expansion are used inside an eval_gettext'argument (all other ones are forbidden). +  * Enkel de voorkomens $parameter en ${parameter} van een parameter expansie worden gebruikt binnen een ''eval_gettext'argument (alle andere voorkomens zijn verboden). 
-  * Positional parameters, special parameters and command substitutions are *notused inside a gettext's or eval_gettext's argument.+  * Positionele parameters, speciale parameters en commando substituties worden *nietgebruikt binnen een argument van ''gettext'' of ''eval_gettext''.
  
-As a practical consequence of the two last rulesit is advisable that all positional parameters, special parameters, command substitutions and not allowed forms of parameter substitutions be assigned upstream to named variablesthen expanded in the text string argument of eval_gettext or eval_negettext.+Een praktisch gevolg van met name de twee laatste vereisten, is het advies om alle positionele parameters, speciale parameters, commando substituties en niet-toegestane vormen van parameter substituties aan de "upstream" ontwikkelaars te melden om een variabele-naam toe te laten wijzenen dan geëxpandeerd in de tekstreeks die als argument van ''eval_gettext'' of ''eval_negettext'' dient.
  
-Tip: if a text string has been included as a msgid in a catalog of messages and is assigned to a named variable in script, then the commands: "gettext $parameter" and "gettext ${parameter}" will output the translated string at run timeeven though 'xgettext' would discard that command when parsing the script, because 'gettext' is used instead of 'eval_gettext'This can be handy. In this case the parameter expansion should not be escaped.+Tip: als een tekstreeks aanwezig is als een "msgidin een berichten catalogus en toegewezen aan een variabele-naam in een script, dan zullen de commando's: "''gettext $parameter''en "''gettext ${parameter}''de vertaalde tekst uitgeven tijdens de script-executie (runtime)zelfs wanneer '''xgettext''' dat commando zo negeren bij het verwerken van het script, omdat  '''gettext''' gebruikt wordt in plaats van '''eval_gettext'''Dit kan handig zijn. In dat geval moet de parameter expansie niet ge-escaped worden.
  
  
-=== Mark messages to be localized ===+=== Markeer berichten om te lokaliseren ===
  
-I recommend to mark messages+Aanbevolen wordt om de volgende tekstberichten te markeren
-  * arguments of a not redirected 'echo' command +  * argumenten van een niet omgeleid '''echo''' commando. 
-  * arguments of redirected 'echo' commands whenever a further processing displays it on user'screen +  * argumenten van omgeleide '''echo''' commando'indien in latere instantie de tekst toch op het scherm van de gebruiker wordt afgebeeld. 
-  * arguments of other commands which displays the messagefor instance the 'dialog' program+  * argumenten van andere commando's die het tekstbericht tonenbijvoorbeeld het '''dialog''' programma.
  
-On the contrary I recommend not to mark+In tegenstelling daarmee is het aan te raden om de volgende niet te markeren
-  * comments intended for readers of the script, +  * commentaren bedoeld voor lezers van het script, 
-  * text string whose value will be processed later, for instance as arguments of a 'case' compound commandor <tag> arguments of a dialog --menu' command.+  * tekstreeks wiens waarde later zal worden verwerktbijvoorbeeld als argumenten voor een '''case''' samengesteld commandoof <tag> argumenten van een '''dialog --menu''' commando.
  
-Sometimes the shell script writes other shell scripts.+Soms schrijft het shell script andere (nieuwe) shell scripts.
  
-Then the developer or maintainer have to decide on a case by case basis what to mark depending on the intended scope of internationalization.+Dan zal de ontwikkelaar of maintainer van geval tot geval moeten beslissen wat er gemarkeerd moet worden, afhankelijk van de reikwijdte van de voorgenomen internationalisatie.
  
-=== Use 'xgettext' to produce a template catalog of messages ===+=== Gebruik 'xgettext' om een sjabloon-catalogus van berichten te produceren ===
  
-The choice to produce only one POT file for the software as a whole or to make one POT files per set of scripts have to be madeconsidering for instance which choice will minimize maintenance workhow localizations work can be organizedrelative frequency of updates for the different sets of scripts which comprise the software, and the relevance of distinguishing groups of features like setup vs configuration vs package management.+Een keuze moet worden gemaakt om een enkel POT bestand te maken voor de software als geheel, danwel een apart POT bestand voor verschillende verzamelingen scripts. Overwegingen zullen zijnwelke keuze minimaliseert het onderhoudswerkhoe kan het werk aan de localisaties het beste worden geörganiseerdwat is de relatieve frequentie van de wijzigingen op de verschillende verzamelingen van scripts die samen de software vormenen de relevantie van de onderscheidende features zoals setup versus configuratie versus pakketbeheer.
  
-I'm inclined to produce only one POT filebut the choice is yours.+De auteur produceert gewoonlijk een enkel POT bestandmaar iedereen moet zijn eigen afwegingen maken.
  
-If the software comprises of numerous scripts located in different places or included in several packagesit can be handy to collect a copy of all scripts in a single directory, and/or to register in a text file a list of all of them with their paths.+indien de software bestaat uit een veelvoud van scripts die op verschillende plaatsen staan of opgenomen zijn in verschillende pakkettenkan het voordelig zijn om een kopie van alle scripts te verzamelen in een enkele directory, en/of in een apart tekstbestand al deze scripts te noteren inclusief hun padnamen.
  
-The POT file will be generated using the 'xgettext' command (see the manual or 'xgettext --help' for details).+Het POT bestand wordt gegenereerd met het '''xgettext''' commando (zie de handleiding of '''xgettext --help''xgettext --help' voor de details).
  
-Include following options in the command:<code> +Neem de volgende opties mee in het commando: <code> 
--L Shell (of course!) +-L Shell (vanzelfsprekend!) 
---strict (to facilitate checks and management of the messages catalogs+--strict (ter ondersteuning van controles en beheer van de berichten catalogi
--c       (to include comments useful for the translators in the POT file+-c       (om commentaren in het POT bestand op te nemen die nuttig zijn voor de vertalers
--n       (to identify the source file and the line number of each message+-n       (identificeert het bronbestand en het regelnummer van ieder tekstbericht
-         This is the default.)</code>+         Dit is de standaard.) 
 +</code>
  
-Once the POT file is generated you could check that it includes entries for all *gettext invocation in shell script(s).+Wanneer het POT bestand eenmaal gegenereerd is moet je controleren dat het secties bevat voor alle ''*gettext'' aanroepen in de shell script(s). 
 +==== Localisatie proces ====
  
-==== Localization process ====+Wanneer het POT bestand klaar is, genereert het '''msginit''' commando daaruit een PO bestand voor iedere doel-taal.
  
-Once the POT file is available, the 'msginit' command writes a PO file for each target language.+In PO bestanden mogen de "msgid" tekstreeksen nooit gewijzigd worden, omdat er anders helemaal geen vertaling zal plaatsvinden tijdens de uitvoering van het script (runtime).
  
-In PO files the "msgid" strings should never be modifiedotherwise the translation won't occur at run time.+Met het '''msgcmp''' commando kun je na de vertaalslag ieder PO bestand controleren tegen het POT bestandom je te verzekeren dat alle tekstberichten vertaald zijn.
  
-The 'msgcmpcommand allow to checks each PO file against the POT after translation, to make sure all messages are translated.+De vertaler kan het '''msgfmt''' commando gebruiken om de layout van de vertaalde tekst te verifiëren.
  
-The translator can use the 'msgfmtcommand to check the layout of the translated text.+Het PO bestand moet zorgvuldig bewaard worden, omdat dit opnieuw nodig is wanneer er onderhoud gepleegd wordt op de vertaling (het is mogelijk om met het '''msgunfmt''' commando uit een MO bestand een PO bestand te re-creëren maar daarbij gaat wel de context verloren, waardoor het resultaat nagenoeg onbruikbaar is).
  
-The PO file should be carefully saved somewhereas it will be needed for subsequent maintenance (it is still possible to 'msgunfmtMO file to re-create a PO file but then you would loose the context, which would make it almost useless).+Het gecontroleerde PO bestand wordt overgedragen aan de maintainerdie dan '''msgfmt''' gebruikt om het MO bestand te produceren en te installeren
  
-The checked PO file is handed over to the maintainer, who runs 'msgfmt' to produce the MO file, then installs it. +==== Gebruik ====
  
-==== Usage process ====+Het enige dat de gebruiker hoeft te doen is het instellen van zijn of haar voorkeurstaal of -talen.
  
-The only thing the user will have to take care of is set up his preferred language(s).+De standaard manier om dat voor elkaar te krijgen is door de LANG omgevingsvariabele de juiste waarde te geven.
  
-The primary way to do that is setting the LANG environment variable.+Dit kan tijdens de script-uitvoering (runtime) gedaan worden door het commando dat wordt gebruikt om het script uit te voeren vooraf te laten gaan door de tekst ''LANG=<locale>'', maar meestal zal de gebruiker zijn voorkeurstaal liever permanent willen instellen.
  
-This can be done at run timepreceding the command used to run the script with LANG=<locale>, but usually the user will set it up permanently.+In Slackware Linux bijvoorbeeldwordt dat bereikt door het aanpassen van het relevante bestand ''/etc/profile.d/lang.sh'' (voor Bash-achtige shell) en/of ''/etc/profile.d/lang.csh'' (voor csh-achtige shell). De inhoud van deze bestanden wijst zichzelf door de er in opgenomen commentaren.
  
-For instance in Slackware Linux this will be done in editing the file(s) /etc/profile.d/lang.sh and/or /etc/profile.d/lang.csh (see these files).+De wijzigingen in die bestanden worden pas effectief bij de eerstvolgende login (bijvoorbeeld na een reboot).
  
-The changes will be effective at next reboot.+Het is aan te raden om een [[wp>UTF-8]] locale te gebruiken.
  
-I suggest to use an UTF-8 locale, as for reading this document.+Voor een meertalige gebruiker (polyglot) is de gettext-specifieke LANGUAGE omgevingsvariabele een mogelijkheid om een geprioritiseerde lijst van talen te specificeren.
  
-If the user is polyglotanother option is to set gettext's specific LANGUAGE environment variable to specify a prioritized list of languages.+Indien bijvoorbeeld LANGUAGE wordt ingesteld op 'de:fr' dan zal een duitse vertaling worden gebruikt indien aanwezigen anders wordt een franse vertaling worden gebruikt indien aanwezig, en in het uiterste geval zullen tekstberichten worden getoond in de  originele taal, gewoonlijk engels. Zie de gettext handleiding voor details. 
 +==== Onderhoud ====
  
-For instanceif LANGUAGE is set to 'de:fr' then a Deutsch translation will be used if available, else a French translation will be used if available, else messages will be displayed in the original language, usually English. See gettext's manual for details.+Meestal zal het onderhoudsproces worden gestart door het creërenwijzigen of verwijderen van een script.
  
-==== Maintenance process ====+In zo'n geval zal de maintainer een nieuw POT bestand genereren met behulp van '''xgettext''' en dat dan doorspelen naar de vertalers.
  
-In most cases the maintenance process will be triggered by a script's creation, modification or deletion.+De vertalers gebruiken dan het nieuwe POT bestand om hun eigen respectieve (eerder opgeslagen) PO bestanden te verversen met het '''msgmerge --update''' commando.
  
-In such a case the maintainer will generate a new POT file with 'xgettext' then hand it hover to the translators.+Met een PO editor worden de vertalingen bijgewerkt en eventueel opnieuw compleet gemaakt, met een focus op nog onvertaalde berichten en ook diegene die als "fuzzy" (onduidelijk/vaag) worden aangemerkt in de PO bestanden.
  
-The translators will use the new POT file to update their respective (saved) PO files with the 'msgmerge --updatecommand.+Na afloop wordt het PO bestand gecontroleerd tegen het POT bestand met '''msgcmp''', zorgvuldig opgeslagen, en overgedragen aan de maintainer. Die zal het  nieuwe MO bestand genereren met '''msgfmt''' en dit bestand installeren op de juiste plek zoals gedefinieerd in het initiële localisatie proces.
  
-Then they will edit/complete the translations, focusing on the not yet translated messages and on those marked as "fuzzy" in the PO filesusing a PO editor. +Het onderhoudsproces dat wordt gestart omdat een PO bestand van een specifieke taal een wijziging behoeft, is vergelijkbaar maar korterhet start met een wijziging van het relevante PO bestand door de vertalerOm de werklast voor de maintainer te beperken zou deze van zijn vertalers kunnen eisen dat hij alleen maar complete en goed gecontroleerde vertalingen toegestuurd krijgt
- +==== Practische aanbevelingen voor ontwikkelaars en maintainers ====
-After that the PO file will be checked against the POT file with 'msgcmp', carefully saved, handed over to the maintainer who will generate the new MO file with 'msgfmt' and install it as in the initial localization process. +
- +
-The maintenance process triggered by a needed modification of a PO file for a specific language is similar, only shorterit will begin with the update of the relevant PO file by the translatorTo minimize the workload caused by this type of maintenance, I suggest that the maintainer demand that he or she be provided only with complete and well reviewed translations. +
- +
-==== Practical recommendations for developers and maintainers ====+
  
 Many English words are polysemous: their meaning can only be determined from the context of their usage.  Many English words are polysemous: their meaning can only be determined from the context of their usage. 
Regel 284: Regel 278:
 Do not fear to include the variable substitutions in the sentences, PO editor will check that they be present as is in the translations. Do not fear to include the variable substitutions in the sentences, PO editor will check that they be present as is in the translations.
  
-=== Recommendations for 'dialog' program. ===+=== Aanbevelingen voor 'dialog' programma. ===
  
 The 'dialog' program provides an UI taking the form of dialog boxes. The 'dialog' program provides an UI taking the form of dialog boxes.
Regel 305: Regel 299:
 For instance,\\ dialog <common-options> --textbox <file> <height> <width>\\ can be replaced with\\ dialog --no-collapse <common-options> --msgbox "`cat <file>`" <height> <width> For instance,\\ dialog <common-options> --textbox <file> <height> <width>\\ can be replaced with\\ dialog --no-collapse <common-options> --msgbox "`cat <file>`" <height> <width>
  
-==== Practical recommendations for translators ====+==== Practische aanbevelingen voor vertalers ====
  
-Depending on amount of work needed and available resourcesthere can be one translator or a team of translators per target language. In all cases, I recommend that at least one person be responsible for organizing the team's workchecking the translations and transmitting the checked PO file to the maintainer(s). Let's call this person the team coordinator.+Afhankelijk van de hoeveelheid werk en beschikbare krachtenkan er een enkele vertaler of een groep vertalers zijn per doel-taal. In alle gevallen is het aan te bevelen dat minstens één persoon verantwoordelijk wordt voor de organisatie van het werk in het team, voor de controles van de vertalingen en het opsturen van het gecontroleerde PO bestand naar de maintainer(s). We zullen deze persoon de team coordinator noemen.
  
-Don't feel obliged to translate verbatimNot only is this rarely the best way to convey the meaningbut in addition this often leads to sentences too long to fit in allowed space.+Voel je niet verplicht om een letterlijke vertaling op te leverenNiet alleen is dit zelden de beste manier om de bedoelingen over te dragenmaar het leidt ook vaak tot zinnen die te lang zijn om in de toegestane ruimte te passen.
  
-Use a specialized PO editor, 'nota general text editorThis will not only prevent inadvertently editing 'msgid' strings but also facilitate their work and automatize additional checks, as the presence of a variable in the translation with the same spelling as in the original.+Gebruik een editor die toegespitst is op het werken met PO bestandenen niet een 'generieketekstverwerkerDit zal enerzijds verhinderen dat er per ongeluk de 'msgid' tekstreeksen zelf worden vertaald en anderzijds ook het vertaalwerk en additionele controles vergemakkelijken; zoals de aanwezigheid van een variabele in de vertaling met dezelfde spelling als in het origineel.
  
-While translating, choose a serif fixed width (or "monospaced"font, like Courier. That allow to visually distinguish characters that otherwise would look the same, and check line's length when that matters.+Kies tijdens het vertalen voor een font met een schreef en vaste breedte (een "monospaced" of typmachine font)zoals Courier. Met zo'n font kun je karakters van elkaar onderscheiden die anders (bijna) hetzelfde zouden lijken, en regellengtes controleren wanneer dat belangrijk is.
  
-If possible, check the layout of the messagesYou could do that looking at the context in the relevant source fileEven better, simply run the translated script. +Houd de indeling van de tekstberichten in de gatenVergelijk deze met de context in het betreffende bronbestandWat nog beter werkt is gewoon uitvoeren van het vertaalde script en het resulterende tekst controleren. \\ Dit is vooral van belang bij het vertalen van dialoog vensters. In het bijzonder moet vermeden worden dat lange zinnen op een enkele regel blijven staan, wanneer het duidelijk is dat de tekst niet kan overvloeien naar de volgende regel.
  
-This is especially important if you are translating dialog boxes. In particular, take care not to write too long sentences on one single line if it appears that the text can't flow on next one.+Houd in gedachten dat bij het werken in VGA mode (zoals in de tekst installers in het bijzonder) de regelbreedte in principe gelimiteerd is tot 80 karakters. In praktijk echter vaak niet meer dan 74.
  
-Bear in mind that in VGA mode (used in text installers, in particular), line's width is limited theoretically to 80 characters, but practically often to 74.+Voeg geen vraagtekens toe als die niet aanwezig zijn in de oorspronkelijke tekst.
  
-Do not add question marks that are not present in the original message.+Indien de tekst refereert aan labels (tekst op de knoppen) van dialoog vensters zoals "OK", "Yes", "NO", "Continue", "Cancel", zul je moeten controleren hoe deze labels in de dialoog interface vertaald worden in je eigen taal. Gebruik dezelfde woorden.
  
-If the message refers to tags (text on the buttons) of dialog boxes, like "OK", "Yes", "NO", "Continue", "Cancel", check how theses tags are translated in your language in dialog's interface and use the same words.+Vermijd informeel taalgebruik en complex technisch woordgebruik.
  
-Avoid colloquialisms and technical slang.+Om een regel af te snijden in een dialoog venster  gebruik je de eind-tekst ''\n''. Het indrukken van de <key>Enter</key> toets zal //geen// "nieuwe regel" karakter invoegen in de tekst die de lezer ziet
  
-To "cut" (or end) a line inside a "dialogbox you should type \n: pressing [Enter] will 'notinsert a "new linecharacter in the text viewed by user+Tot slot moet aan de vereisten worden voldaan die bij het gebruik van ''gettext'' horen: 
 +  * Indien een woord voorkomt in de originele tekst dat begint met een dollar-teken moet het ook in de vertaalde tekst aanwezig zijn  met precies dezelfde spelling (met inbegrip van hoofd/kleine letters). 
 +  * De vertaalde tekst moet een "nieuwe regelkarakter (ook wel "line feedgenoemd, gerepresenteerd door "''\n''") aan het begin of aan het eind hebben staan als de oorspronkelijke tekst dat ook heeft. Omgekeerd, als de oorspronkelijke tekst dit karakter niet heeft, dan moet de vertaalde tekst het ook niet bevatten. 
 +  * Een enkel backslash karakter "''\''" (omgekeerde schuine streep) is niet toegestaan in de vertaling.
  
-In addition, you will have to comply to gettext's requirements for it to work+Om je vertaling te controleren tegen de ''gettext'' vereisten kun je het volgende commando uitvoeren
-  * If a word beginning with a dollar sign is included in the original text it should be present in the translation with exactly the same spelling (case matters). +  msgfmt -c <naam van het PO bestand> 
-  * The translation text should include a "new line" character (or line feed, represented by "\n") at the beginning or at the end, exactly as the original text does. Conversely, if the original text doesn’t have the character, then the translation shouldn’t have it. +==== Waarschuwing over vertaling van man paginas ====
-  * A single backslash character "\" is not allowed in the translation.+
  
-To "cut" (or end) a line inside a "dialog" box you should type \n: pressing [Enter] will 'not' insert a "new line" character in the text viewed by user.+Behoud zorgvuldig de syntax van man pagina's zoals die in de Engelse markup gevonden wordtWat je bijvoorbeeld niet moet vervangen:
  
-To check your translation against gettext's requirements you could run following command: +  * 'B<' door 'B <' (voeg geen spatie toe) 
-  msgfmt -c <name of the PO file>+  * 'B<' door 'b<' (houd B als een hoofdletter - en vervang het ook niet door de Griekse hoofdletter BETA die er op het scherm identiek uitziet) 
 +  * "I" door '|' (vervang de hoofdletter I niet door een pipe symbool)
  
-==== Warning  about translation of man pages ====+Bewaar bij een vertaling van shell commando's de Engelse pad-namen waar nodig. Maar je mag (en moet) argumenten vertalen die bij uitvoering van het commando vervangen worden door een waarde of string - zoals 'packagename'.
  
-Preserve carefully syntax of man pages found in English markup. For instance don't replace:+====== Bronnen ======
  
-  * 'B<' with 'B <' (don't insert a space) +  * Origineel geschreven door [[wiki:user:didierspaier | Didier Spaier]] 
-  * 'B<' with 'b<' (keep the B as a capital letter - and don't replace it by the Greek capital letter BETA that looks the same on the screen) +  * Vertaling door [[wiki:user:alienbob|Eric Hameleers]]
-  * "I" with '|' (don't replace the capital letter I with a pipe symbol) +
- +
-When translating shell commands, preserve English names of paths when needed. But you may and should translate arguments to be replaced by a value like 'packagename' +
- +
-Didier Spaier +
- +
-====== Bronnen ====== +
-* Origineel geschreven door [[wiki:user:didierspaier | Didier Spaier]] +
-* Vertaling door [[wiki:user:alienbob|Eric Hameleers]]+
  
-{{tag>howtos gettext shell scripts internationalization localization i18n l10n}}+{{tag>howtos gettext shell scripts internationalization localization i18n l10n author_alienbob}}
  
Afdrukken/exporteren
 nl:howtos:misc:internationalization_and_localization_of_shell_scripts ()