XLNG est une collection d'outils pour gérer les traductions de logiciels. Il existe déjà des outils pour gérer les traductions comme gettext. Gettext utilise plusieurs fichiers pour gérer les translations. Avec XLNG toutes les informations sont incluses dans le fichiers d'exécution. XLNG n'est pas un remplaçant de gettext, il s'agit juste d'une autre approche.
XLNG a été initialement développé pour les programmes C. D'autres langage pourront être supportés.
Lors de l'écriture du programme, quand le développeur a besoin d'un label, il utilise un identifiant. La fonction
XLNG_GetLng()permet d'obtenir le label dans la langue en cours.
printf( XLG_GetLng( xGEN_Std_hello ) ) |
Dans un autre fichier .XLNG, on retrouve le lien entre l'identifiant et le label à afficher.
<trans-unit id="cGEN_Std_Hello"> <source xml:lang="fr">Bonjour</source> <target xml:lang="en">Good morning</target> <target xml:lang="de">Guten tag</target> </trans-unit> |
XLNG est format de fichier XML.
trans-unit unité de traduction.
target or source strictement équivalent, il s'agit de la traduction dans une langue.
note note ou commentaire, peut-être utiliser pour trans-unit ou target.
example_1.xlng |
---|
<?xml version="1.0"?> <xlg version="0.1"> <body> <trans-unit id="cGEN_Std_Hello"> <source xml:lang="fr">Bonjour</source> <target xml:lang="en">Good morning</target> <target xml:lang="de">Guten tag</target> </trans-unit> <trans-unit id="cGEN_Std_Yes"> <source xml:lang="fr">Oui</source> <target xml:lang="en">Yes</target> <target xml:lang="de">Ja</target> <target xml:lang="it">Si</target> </trans-unit> </body> </xlg> |
Exemple de fichier de configuration XLNG:
xlg_config.xlng |
---|
<?xml version="1.0"?> <xlg version="0.1"> <head> <lang>fr</lang> <lang>de</lang> </head> </xlg> |
Exemple d'utilisation de traduction XLNG:
example_1.c |
---|
#include <stdlib.h> #include <stdio.h> #include <xlg.h> #include <xlg_config.h> #include <example.lh> void main(void) { printf( XLG_GetLng( xGEN_Std_hello ) ) } |
<?xml version="1.0"?> <xlg version="0.1"> <body> <trans-unit id="cGEN_Std_Hello"> <note>A simple and polite salutation</note> <source xml:lang="fr" from="Dupond status="new"">Bonjour</source> <source xml:lang="fr" from="Dupont status="false"">Salut<note>Trop vulgaire</note></source> <target xml:lang="en" from="Smith">Good morning</target> <target xml:lang="de" from="Schmidt" status="validate">Guten tag</target> </trans-unit> <trans-unit id="cGEN_Std_Yes"> <source xml:lang="fr">Oui</source> <target xml:lang="en">Yes</target> <target xml:lang="de">Ja</target> <target xml:lang="it">Si</target> </trans-unit> </body> </xlg> |
Allez sur le site codingteam pour télécharger la dernier version : http://codingteam.net/project/xlng/download.
Licence: Copyright (C) 2007-2008 This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution.