Hello there,
I am writing scripts for work, and I need to make them available in various languages. I have worked something out, but I saw that Gimp proposed tools with gettext, N_ etc...
Does someone know what is the right way to make an i18n of your python script ?
Here is what I have worked out :
from gimpfu import *
from math import pi
from cmath import phase
from os import environ
txts = {
'message no path' : {
'en':'No path selected',
'fr':'Aucun chemin selectionne',
'es':'No hay ninguna ruta seleccionada'},
'message no txt along path' : {
'en':'Text along path plugin required, v0.4 recomanded',
'fr':'Plugin Text along path requis, v0.4 recommande',
'es':'Se necesita el plugin Text along path, mejor v0.4'},
'short description quick arrow' : {
'en':'Create an arrow from a vector',
'fr':'Cree une fleche a partir d un chemin',
'es':'Crea una flecha con un camino'},
'long description quick arrow' : {
'en':'Create an arrow from a vector without options',
'fr':'Cree une fleche a partir d un chemin sans demander d option',
'es':'Crea una flecha con un camino sin optiones'},
'short description arrow' : {
'en':'Create an arrow from a vector',
'fr':'Cree une fleche a partir d un chemin',
'es':'Crea una flecha con un camino'},
'long description arrow' : {
'en':'Create an arrow from a vector with options',
'fr':'Cree une fleche a partir d un chemin avec des options',
'es':'Crea una flecha con un camino con optiones'},
'option text' : {
'en':'Text',
'fr':'Texte',
'es':'Texto'},
'option shaft width' : {
'en':'Width of the shaft',
'fr':'Largeur de la tige',
'es':'Ancho del eje'},
'option spike ratio' : {
'en':'Size of the head (times the shaft)',
'fr':'Taille de la pointe p/r a la tigh',
'es':'Tamano de la flecha x el eje'},
'option color 1' : {
'en':'Color of the arrow',
'fr':'Couleur de la fleche',
'es':'Color de la flecha'},
'option is border' : {
'en':'With border?',
'fr':'Avec bord ?',
'es':'Con borde?'},
'option color 2' : {
'en':'Color of border and text',
'fr':'Couleur du bord et du text',
'es':'Color del borde y del texto'}
}
language = environ['LANGUAGE']
default_language = "en"
txt = {}
for (key, val) in txts.items():
if val.has_key(language):
txt[key] = val[language]
else:ñ
txt[key] = val[default_language]
I have an issue with the environ['LANGUAGE'] value : on my window desk computer it is "es" for Spanish, and on my laptop it is "es_CO:es". I guess the part before the semicolon is relative to the country and the part after is relative to the language. Someone knows the formate of this variable ? if not could you write in your gimp python console the lines
import os
os.environ['LANGUAGE']
and give me the output ?