Hi Merlijn,
I've seen it during discussion with Nikerabbit on tw.net (look at the first LQ-threat according pywikipedia) and I am working on a pythonic version of the plural-gettext.txt. I am using lambda function for that like this one (for mk-wiki): plural = lambda n: 0 if (n == 1 or n%10 == 1) else 1 I think this is the easiest way. But we have a remaining problem found on table2wiki. Now we have 3 messages. One message is used if we have no warning, and we have two messages either for one or a lot of warnings. I guess we could keep the first "table2wiki-no-warning" message and merge the two messages "table2wiki-one-warning" and "table2wiki-warnings" using {{Plural:}} tag. It is also possible to use the first message every time and append the warning message if needed.
Greetings
----- Original Nachricht ---- Von: Merlijn van Deen valhallasw@arctus.nl An: pywikipedia-l@lists.wikimedia.org Datum: 25.08.2011 19:46 Betreff: Re: [Pywikipedia-l] [Pywikipedia-svn] SVN: [9448] trunk/pywikipedia/pywikibot/i18n.py
Hello xqt,
On 21 August 2011 15:49, xqt@svn.wikimedia.org wrote:
- value. At the moment, we have only one plural_func = x: x!= 1 yet.
Multiple
- PLURAL tags are not supported (yet).
Good to see you're working on plural support. Have you seen http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Translate/data/pl ural-gettext.txt?view=markup , which lists the plural possibilities for each language. Unfortunately, python does not support the a ? b : c notation, so it's not possible to copy the code 1-on-1.
Alternatively, there is http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Translate/data/pl ural-cldr.yaml?view=markup , but that is fairly unreadable IMO.
Good luck!
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Arcor empfiehlt: Mal über die Karriere nachdenken! Wissenswertes und Nützliches finden Sie hierzu unter http://www.arcor.de/content/finanzen_job/job_karriere/bewerbung_karriere/rat...
Hi Xqt,
On 26 August 2011 03:12, info@gno.de wrote:
I've seen it during discussion with Nikerabbit on tw.net (look at the first LQ-threat according pywikipedia) and I am working on a pythonic version of the plural-gettext.txt. I am using lambda function for that like this one (for mk-wiki): plural = lambda n: 0 if (n == 1 or n%10 == 1) else 1 I think this is the easiest way.
Yes, this makes sense. Can TW output a formatted version? Anyway, I would suggest using the same dict-based format as the other translations, i.e.
{ 'en': lambda n: 0 if (n == 0 or n > 1) else 1, 'mk': lambda n: 0 if (n==1 or n%10=1) else 1, }
etc, which would make it easy to use in python. But you probably already thought of that :-)
But we have a remaining problem found on table2wiki. Now we have 3 messages.
One message is used if we have no warning, and we have two messages either for one or a lot of warnings. I guess we could keep the first "table2wiki-no-warning" message and merge the two messages "table2wiki-one-warning" and "table2wiki-warnings" using {{Plural:}} tag. It is also possible to use the first message every time and append the warning message if needed.
Yes, this makes sense. I would suggest using 'no edits' and 'there are n edits', which makes sense as a distinction. TW is dynamic enough to quickly translate merged messages, I guess.
anyway -- good luck implementing :-)
Best, Merlijn
Hi Merlijn,
Yes, this makes sense. Can TW output a formatted version? Anyway, I would suggest using the same dict-based format as the other translations, i.e.
{ 'en': lambda n: 0 if (n == 0 or n > 1) else 1, 'mk': lambda n: 0 if (n==1 or n%10=1) else 1, }
etc, which would make it easy to use in python. But you probably already thought of that :-)
My idea was just put that dict into i18n.py. btw I found it also works without lambda.
Greetings xqt
Arcor empfiehlt: Mal über die Karriere nachdenken! Wissenswertes und Nützliches finden Sie hierzu unter http://www.arcor.de/content/finanzen_job/job_karriere/bewerbung_karriere/rat...
Sorry for going a little bit off-topic here, but I have a question: (and I think this is the best place to get a helpful answer ;)
As some of you might know I'm using the trunk (not re-write) version of the framework for DrTrigonBot too.
I'm thinking about a good implementation for translations. As you are switching to translatewiki I would like to do this also. The actual question is how to do so?? As far as I can see my project is not that important to need an own account on translatewiki...? Or am I wrong? May be it would make sence to include my translations into the pywikipedia bot framework directly, since I do not use that many messages...
Any help or hint is greatly appreciated.
Thanks and greetings! Dr. Trigon
Am 26.08.2011 03:12, schrieb info@gno.de:
Hi Merlijn,
I've seen it during discussion with Nikerabbit on tw.net (look at the first LQ-threat according pywikipedia) and I am working on a pythonic version of the plural-gettext.txt. I am using lambda function for that like this one (for mk-wiki): plural = lambda n: 0 if (n == 1 or n%10 == 1) else 1 I think this is the easiest way. But we have a remaining problem found on table2wiki. Now we have 3 messages. One message is used if we have no warning, and we have two messages either for one or a lot of warnings. I guess we could keep the first "table2wiki-no-warning" message and merge the two messages "table2wiki-one-warning" and "table2wiki-warnings" using {{Plural:}} tag. It is also possible to use the first message every time and append the warning message if needed.
Greetings
----- Original Nachricht ---- Von: Merlijn van Deen valhallasw@arctus.nl An: pywikipedia-l@lists.wikimedia.org Datum: 25.08.2011 19:46 Betreff: Re: [Pywikipedia-l] [Pywikipedia-svn] SVN: [9448] trunk/pywikipedia/pywikibot/i18n.py
Hello xqt,
On 21 August 2011 15:49, xqt@svn.wikimedia.org wrote:
- value. At the moment, we have only one plural_func = x: x!= 1 yet.
Multiple
- PLURAL tags are not supported (yet).
Good to see you're working on plural support. Have you seen http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Translate/data/pl ural-gettext.txt?view=markup , which lists the plural possibilities for each language. Unfortunately, python does not support the a ? b : c notation, so it's not possible to copy the code 1-on-1.
Alternatively, there is http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Translate/data/pl ural-cldr.yaml?view=markup , but that is fairly unreadable IMO.
Good luck!
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Arcor empfiehlt: Mal über die Karriere nachdenken! Wissenswertes und Nützliches finden Sie hierzu unter http://www.arcor.de/content/finanzen_job/job_karriere/bewerbung_karriere/rat...
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
No 'i18n'-expert out there, able to give me some hints?
Am 28.08.2011 13:27, schrieb Dr. Trigon:
Sorry for going a little bit off-topic here, but I have a question: (and I think this is the best place to get a helpful answer ;)
As some of you might know I'm using the trunk (not re-write) version of the framework for DrTrigonBot too.
I'm thinking about a good implementation for translations. As you are switching to translatewiki I would like to do this also. The actual question is how to do so?? As far as I can see my project is not that important to need an own account on translatewiki...? Or am I wrong? May be it would make sence to include my translations into the pywikipedia bot framework directly, since I do not use that many messages...
Any help or hint is greatly appreciated.
Thanks and greetings! Dr. Trigon
Am 26.08.2011 03:12, schrieb info@gno.de:
Hi Merlijn,
I've seen it during discussion with Nikerabbit on tw.net (look at the first LQ-threat according pywikipedia) and I am working on a pythonic version of the plural-gettext.txt. I am using lambda function for that like this one (for mk-wiki): plural = lambda n: 0 if (n == 1 or n%10 == 1) else 1 I think this is the easiest way. But we have a remaining problem found on table2wiki. Now we have 3 messages. One message is used if we have no warning, and we have two messages either for one or a lot of warnings. I guess we could keep the first "table2wiki-no-warning" message and merge the two messages "table2wiki-one-warning" and "table2wiki-warnings" using {{Plural:}} tag. It is also possible to use the first message every time and append the warning message if needed.
Greetings
----- Original Nachricht ---- Von: Merlijn van Deen valhallasw@arctus.nl An: pywikipedia-l@lists.wikimedia.org Datum: 25.08.2011 19:46 Betreff: Re: [Pywikipedia-l] [Pywikipedia-svn] SVN: [9448] trunk/pywikipedia/pywikibot/i18n.py
Hello xqt,
On 21 August 2011 15:49, xqt@svn.wikimedia.org wrote:
- value. At the moment, we have only one plural_func = x:
x!= 1 yet. Multiple + PLURAL tags are not supported (yet).
Good to see you're working on plural support. Have you seen http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Translate/data/pl
ural-gettext.txt?view=markup
, which lists the plural possibilities for each language. Unfortunately, python does not support the a ? b : c notation, so it's not possible to copy the code 1-on-1.
Alternatively, there is http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Translate/data/pl
ural-cldr.yaml?view=markup
, but that is fairly unreadable IMO.
Good luck!
Best, Merlijn
_______________________________________________ Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Arcor empfiehlt: Mal über die Karriere nachdenken! Wissenswertes und Nützliches finden Sie hierzu unter http://www.arcor.de/content/finanzen_job/job_karriere/bewerbung_karriere/rat...
_______________________________________________
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
_______________________________________________ Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
On 28 August 2011 13:27, Dr. Trigon dr.trigon@surfeu.ch wrote:
I'm thinking about a good implementation for translations. As you are switching to translatewiki I would like to do this also. The actual question is how to do so??
At the moment, there is not really an obvious answer for scripts not in svn, as all translations are stored in svn. I'm not sure if it's possible to create translations on translatewiki.net for keys that are not already in svn.
If this is possible, the most reasonable solution to me would be this: 1) follow the guide to translating ( http://lists.wikimedia.org/pipermail/pywikipedia-l/2011-January/006632.html) 2) use keys starting with 'thirdparty-drtrigon'; i.e. thirdparty-drtrigon- 3) if you can create the keys on translatewiki: do that. if not: b) submit a bug report to get your translations in svn, so they can be translated
There might be some problems with the location of translation files, however (I think pywikipedia will search them in the i18n subfolder based on the script you are running, which will fail if your scripts are not in the same location as the other pywikipedia scripts). Might be solveable with some symlinks, though.
Best, Merlijn
I do not see a new translation group is necessary for your purposes. In fact I see few posibilities:
- you may recycle translations in the i18n folder if it fits - if your script is able to be distributed we could commit (with i18n extension) - I am implementing translated bot owner messages wich (hopefull) coming soon. If so, you may check whether there are messages to re-use - finally we could implement bot-specific messages as part of the pwb framework and port them to translatewiki like other messages. We could handle with drtrigonbot.py, xqbot.py valhallasw-bot.py as well. Maybe they should get a thirdparty-suffix.
best regards xqt
----- Original Nachricht ---- Von: Merlijn van Deen valhallasw@arctus.nl An: Pywikipedia discussion list pywikipedia-l@lists.wikimedia.org Datum: 30.08.2011 13:23 Betreff: Re: [Pywikipedia-l] [Pywikipedia-svn] SVN: [9448] trunk/pywikipedia/pywikibot/i18n.py
On 28 August 2011 13:27, Dr. Trigon dr.trigon@surfeu.ch wrote:
I'm thinking about a good implementation for translations. As you are switching to translatewiki I would like to do this also. The actual question is how to do so??
At the moment, there is not really an obvious answer for scripts not in svn, as all translations are stored in svn. I'm not sure if it's possible to create translations on translatewiki.net for keys that are not already in svn.
If this is possible, the most reasonable solution to me would be this:
- follow the guide to translating (
http://lists.wikimedia.org/pipermail/pywikipedia-l/2011-January/006632.html)
- use keys starting with 'thirdparty-drtrigon'; i.e.
thirdparty-drtrigon- 3) if you can create the keys on translatewiki: do that. if not: b) submit a bug report to get your translations in svn, so they can be translated
There might be some problems with the location of translation files, however (I think pywikipedia will search them in the i18n subfolder based on the script you are running, which will fail if your scripts are not in the same location as the other pywikipedia scripts). Might be solveable with some symlinks, though.
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
First thanks Merlijn and xqt for you answers!! In order to get one step further I tried to follow Merlijn hints:
If this is possible, the most reasonable solution to me would be this: 1) follow the guide to translating (http://lists.wikimedia.org/pipermail/pywikipedia-l/2011-January/006632.html)
Ok.
BUT I did the migration by hands (since it's the first one) as visible in [1] and when going further to create and upload a script to i18n folder I got stuck: - - I'm using the trunk not the rewrite; the guide uses rewrite and I cannot find the files in i18n directory in trunk, just the i18n.py in pywikibot but not the mentioned 'i18n.<package>'... - - I do not have commit access - - I wonder what does happen now with the translations on TW? Do they get synced into the i18n folder? ...or what's the idea?
- use keys starting with 'thirdparty-drtrigon'; i.e.
thirdparty-drtrigon-
As mentioned I created a bunch of keys, this works which is good!
- you may recycle translations in the i18n folder if it fits
Yes - in fact I though about something like this too. ;) But could become very tricky... ;)
- if your script is able to be distributed we could commit (with
i18n extension)
In my opinion it is (more or less) since I am using it... ;) But I do not know what are your demands on quality... I think you have to decide whether my code fits or not... I have also to admit that I cannot spend the same amount of time in support and developpment as desirable.
- I am implementing translated bot owner messages wich (hopefull)
coming soon. If so, you may check whether there are messages to re-use - finally we could implement bot-specific messages as part of the pwb framework and port them to translatewiki like other messages. We could handle with drtrigonbot.py, xqbot.py valhallasw-bot.py as well. Maybe they should get a thirdparty-suffix.
Both sound intressing, can you may be elaborate some further details on this?
[1] http://translatewiki.net/w/i.php?title=Special%3APrefixIndex&prefix=Thir...
Thanks a lot for your detailed explanations and Greetings Dr. Trigon
I think it was not a good idea to create these entries in tw directly. The normal way is to create a dictionary as described and make a request at sf (or send a mail to me as well). i18n dicts are placed in the rewrite branch. In trunk release i18n directory is defined as svn:external which copies its content from rewrite.
There is no automatic mechanism to synchonize these dicts from pywikipedia svn to tw and vice versa. It is necessary to outcheck pwb svn at tw and to expand the yaml config file at mw svn and perhaps run fuzzy bot to import the given translations.
From time to time the i18n dictionaries are created and backported to pwb svn.
Greetings xqt
----- Original Nachricht ---- Von: "Dr. Trigon" dr.trigon@surfeu.ch An: pywikipedia-l@lists.wikimedia.org Datum: 03.09.2011 17:36 Betreff: Re: [Pywikipedia-l] [Pywikipedia-svn] SVN: [9448] trunk/pywikipedia/pywikibot/i18n.py
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
First thanks Merlijn and xqt for you answers!! In order to get one step further I tried to follow Merlijn hints:
If this is possible, the most reasonable solution to me would be this: 1) follow the guide to translating
(http://lists.wikimedia.org/pipermail/pywikipedia-l/2011-January/006632.html )
Ok.
BUT I did the migration by hands (since it's the first one) as visible in [1] and when going further to create and upload a script to i18n folder I got stuck:
I cannot find the files in i18n directory in trunk, just the i18n.py in pywikibot but not the mentioned 'i18n.<package>'...
- I'm using the trunk not the rewrite; the guide uses rewrite and
- I do not have commit access
get synced into the i18n folder? ...or what's the idea?
- I wonder what does happen now with the translations on TW? Do they
- use keys starting with 'thirdparty-drtrigon'; i.e.
thirdparty-drtrigon-
As mentioned I created a bunch of keys, this works which is good!
- you may recycle translations in the i18n folder if it fits
Yes - in fact I though about something like this too. ;) But could become very tricky... ;)
- if your script is able to be distributed we could commit (with
i18n extension)
In my opinion it is (more or less) since I am using it... ;) But I do not know what are your demands on quality... I think you have to decide whether my code fits or not... I have also to admit that I cannot spend the same amount of time in support and developpment as desirable.
- I am implementing translated bot owner messages wich (hopefull)
coming soon. If so, you may check whether there are messages to re-use - finally we could implement bot-specific messages as part of the pwb framework and port them to translatewiki like other messages. We could handle with drtrigonbot.py, xqbot.py valhallasw-bot.py as well. Maybe they should get a thirdparty-suffix.
Both sound intressing, can you may be elaborate some further details on this?
[1] http://translatewiki.net/w/i.php?title=Special%3APrefixIndex&prefix=Thir... ty-drtrigonbot&namespace=1238
Thanks a lot for your detailed explanations and Greetings Dr. Trigon -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk5iSYAACgkQAXWvBxzBrDAtuACgkCDRc+Bs/Utv+0EdmPvqlV6y smcAoJU/PvBZHkrdAQ8Biu6mRhKlA97+ =MCWB -----END PGP SIGNATURE-----
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I think it was not a good idea to create these entries in tw directly.
That's a pitty! Sorry for that... I was confused by "if you can create the keys on translatewiki: do that."
The normal way is to create a dictionary as described and make a request at sf (or send a mail to me as well).
OK; so I did as you told me and created such a file with dict according to the guide (but using trunk), the file 'thirdparty' is attached. But I have to tell that using the script mentioned in guide did not work well for me, beacuse of using trunk and slightly other key names...
Testing worked quite well, with:
import wikipedia as pywikibot from pywikibot import i18n i18n.twtranslate(pywikibot.getSite(),
'thirdparty-drtrigonbot-sum_disc-parse') u':* %s: %s - [%s letzte Bearbeitung] ({{PAGESIZE:%s}} Bytes) von %s (%s)'
(I know the '%s' should be explicitely named - that will be next step..)
i18n dicts are placed in the rewrite branch. In trunk release i18n directory is defined as svn:external which copies its content from rewrite.
OK thanks! (may be that should be quite obvious to me... ;)
There is no automatic mechanism to synchonize these dicts from pywikipedia svn to tw and vice versa. It is necessary to outcheck pwb svn at tw and to expand the yaml config file at mw svn and perhaps run fuzzy bot to import the given translations.
From time to time the i18n dictionaries are created and backported to pwb svn.
So this is what you are doing for all translations in i18n directory? Is this done manually? Do I have to do that also?
Greetings and thanks for support!
pywikipedia-l@lists.wikimedia.org