Le Tue, 23 Apr 2019 23:48:13 +0200, Miguel <rosen644...@gmail.com> a écrit :
> El Tue, 23 Apr 2019 15:52:19 +0200 > Julien Lepiller <jul...@lepiller.eu> escribió: > > Le Tue, 23 Apr 2019 15:33:32 +0200, > > Ludovic Courtès <l...@gnu.org> a écrit : > > > > > Hello Miguel & Meiyo, > > Hi! > > > > Thanks a lot for your translations of the Guix manual! > > Thank you too for your effort and kindness. > > > > (...) > > > If we look at these, you both translated, for example, the > > > “Packaging Guidelines” string. However, you also left, in your > > > translations, things like “@pxref{Packaging Guidelines}”. > > > (...) > > No, we have a small script that takes care of this. As long as the > > node name is translated somewhere near the beginning of the file, it > > is also automatically translated in the rest of the file. So that > > shouldn't cause an issue. Maybe there's an error in the script? > > > > Look at xref_command in doc/local.mk > > > > Also look at fr.po, I haven't translated most of the node names. > > It took me some time getting that, by example from fr.po, of course, > but I think there are some errors or warnings related when you do it > wrong. AFAIK the only problem are some @ref or @xref entries that > contain the link and some text, that actually must be translated. I > have to double check them this week on the translation. > > > > Could you please translate all the node names, and make sure that > > > all the cross-reference commands use the same names? (The plan is > > > to release Guix 1.0 in one week, so it would be great if you could > > > send an updated PO file by then!) > > I hope having more than only the node names this week. Pretty sure it > won't be the full translation, but I hope reaching 70% at least for > 1.0. We'll see... The attached python script (it requires python and python-polib) might get you closer by automatically translating some very common strings. So you have to change these lines: regexps.append([re.compile('English regexp'), 'Translate string']) #1, #2 etc. are replaced by the content of the matches in the English regexp. I don't know if you'll use it, but I hope it will be of some help to you. Good luck with the translation! > > Happy hacking, > Miguel
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Template Translator v0.1 # Traduit automatiquement certaines chaine de caractères des paquets # Publié par roptat <jul...@lepiller.eu> le 8 août 2016 # sous la licence gnu General Public License version 3 pubilée par la Free Software Foundation. # Visitez <http://www.gnu.org/licenses/> pour obtenir la licence. import sys import re import polib files = sys.argv files.pop(0) def convert(entry, regexp, template): m = regexp.match(entry.msgid) # do not modify anything if the translation is already correct if m and ("fuzzy" in entry.flags or not entry.msgstr): msgstr = template try: msgstr = msgstr.replace("#1", m.group(1)) msgstr = msgstr.replace('#2', m.group(2)) msgstr = msgstr.replace('#3', m.group(3)) msgstr = msgstr.replace('#4', m.group(4)) except: x=1 entry.msgstr = msgstr if "fuzzy" in entry.flags: entry.flags.remove("fuzzy") # regexps regexps = [] regexps.append([re.compile('{Scheme Procedure} (.*)$'), '{Procédure Scheme} #1']) regexps.append([re.compile('{Scheme Variable} (.*)$'), '{Variable Scheme} #1']) regexps.append([re.compile('{Data Type} (.*)$'), '{Type de données} #1']) regexps.append([re.compile('@code{([^}]*)} \\(default:? #t\\)$'), '@code{#1} (par défaut : #t)']) regexps.append([re.compile('@code{([^}]*)} \\(default:? ([0-9]*)\\)$'), '@code{#1} (par défaut : #2)']) regexps.append([re.compile('@code{([^}]*)} \\(default:? @code{([^}]*)}\\)$'), '@code{#1} (par défaut : @code{#2})']) regexps.append([re.compile('@code{([^}]*)} \\(default:? @var{([^}]*)}\\)$'), '@code{#1} (par défaut : @var{#2})']) regexps.append([re.compile('@code{([^}]*)} \\(default:? "([^"]*)"\\)$'), '@code{#1} (par défaut : "#2")']) regexps.append([re.compile('{@code{([^}]*)} parameter} ([^ ]*) ([^ ]*)$'), '{paramètre de @code{#1}} #2 #3']) regexps.append([re.compile('The ([^ ]*) package to use.$'), 'Le paquet #1 à utiliser.']) regexps.append([re.compile('Defaults to @samp{([^}]*)}.$'), 'La valeur par défaut est @samp{#1}.']) regexps.append([re.compile('Available @code{(.*)} fields are:$'), 'Les champs de @code{#1} disponibles sont :']) po = polib.pofile(files[0]) for entry in po: for reg in regexps: convert(entry, reg[0], reg[1]) po.save()