all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: Miguel <rosen644835@gmail.com>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: Translation of the Guix manual & node names
Date: Tue, 23 Apr 2019 23:59:00 +0200	[thread overview]
Message-ID: <20190423235900.480eada2@sybil.lepiller.eu> (raw)
In-Reply-To: <20190423234813.4d270de2@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2347 bytes --]

Le Tue, 23 Apr 2019 23:48:13 +0200,
Miguel <rosen644835@gmail.com> a écrit :

> El Tue, 23 Apr 2019 15:52:19 +0200
> Julien Lepiller <julien@lepiller.eu> escribió:
> > Le Tue, 23 Apr 2019 15:33:32 +0200,
> > Ludovic Courtès <ludo@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: templatetranslator.py --]
[-- Type: text/x-python, Size: 2385 bytes --]

#!/usr/bin/python3
# -*- coding: utf-8 -*-

#    Template Translator v0.1
#    Traduit automatiquement certaines chaine de caractères des paquets

#    Publié par roptat <julien@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()


  parent reply	other threads:[~2019-04-23 21:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 13:33 Translation of the Guix manual & node names Ludovic Courtès
2019-04-23 13:52 ` Julien Lepiller
2019-04-23 21:48   ` Miguel
2019-04-23 21:56     ` Laura Lazzati
2019-04-26 11:01       ` Miguel
2019-04-23 21:59     ` Julien Lepiller [this message]
2019-04-23 22:45   ` Ludovic Courtès
2019-04-24  7:08   ` Meiyo Peng
2019-04-24  7:24     ` Julien Lepiller
2019-05-14  2:29       ` Meiyo Peng
2019-05-17 22:48         ` bug#35786: Some manual @ref @xref @pxref fail when untranslated pelzflorian (Florian Pelz)
2019-05-18  7:40           ` Julien Lepiller
2019-05-23  4:05           ` bug#35786: " Meiyo Peng
2022-06-11 11:24           ` bug#35786: " pelzflorian (Florian Pelz)
2019-04-23 18:11 ` Translation of the Guix manual & node names Meiyo Peng
2019-04-24  6:44   ` pelzflorian (Florian Pelz)
2019-04-24  7:31     ` Julien Lepiller
2019-04-24  8:51       ` pelzflorian (Florian Pelz)
2019-04-24  9:24         ` Julien Lepiller
2019-04-24 10:36           ` pelzflorian (Florian Pelz)
2019-04-25  8:56         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190423235900.480eada2@sybil.lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=guix-devel@gnu.org \
    --cc=rosen644835@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.