Thanks for the quick fix!

------
sent from my mobile, all typos are due to autocorrect ;)

On Sun, 28 Feb 2021, 14:53 , <i...@gno.de> wrote:

> Solution submitted. Will upload it to pypi shortly. Thanks to Merlijn for
> review.
>
> Best
> xqt
>
> Am 28.02.2021 um 12:18 schrieb i...@gno.de:
>
> I opened T275981 for it.
>
> Best
> xqt
>
> Am 27.02.2021 um 14:27 schrieb Merlijn van Deen (valhallasw) <
> valhall...@arctus.nl>:
>
> 
> Hi André,
>
> Looking at
> https://github.com/wikimedia/pywikibot/blob/master/pywikibot/i18n.py#L6,
> it sounds to me like in principe the core Pywikibot code should never call
> i18n.*.
>
> There are currently a few places where this _does_ happen:
>
> * pagegenerators.py, which uses a fallback in case i18n data is not
> available:
> https://github.com/wikimedia/pywikibot/blob/master/pywikibot/pagegenerators.py#L641
> -- so these are OK.
> * page/__init__.py calls twtranslate in:
>   1) the cosmetic changes fallback. This one is a little difficult to fix
> -- maybe it should fall back to a hardcoded English string in case i18n is
> not available?
>   2) the touch method. The method should probably require summary to be
> passed as part of the method signature. The corresponding script
> scripts/touch.py / scripts/newitem.py can then do the i18n lookup.
>        ... in principle, we could also just use a hardcoded summary and
> not bother translating. After all, touch is supposed to *not modify* the
> text and therefore the edit summary _shouldn't be visible_.*..*
>
> Indeed the other approach would be to bundle a subset of i18n data with
> the framework (these are all in scripts/i18n/pywikibot). However the
> loading setup is a little bit complex due to the data being json files that
> could be in a (zipped) Python package...
>
> Cheers,
> Merlijn
>
>
> On Thu, 25 Feb 2021 at 14:30, André Costa <lokal.pro...@gmail.com> wrote:
>
>> Hi all,
>>
>> I'm building a small pywikibot tool[1] which is designed to be installed
>> via pip (and in turn installs Pywikibot via pip).
>>
>> The tool uses the page.touch() function which is where I get a
>> pywikibot.i18n.TranslationError when I run it.
>>
>> page.touch() gets it's edit summary from i18n.twtranslate(self.site,
>> 'pywikibot-touch') which in turn is defined in /scripts/i18n/pywikibot/.
>> Unless I'm confused the Error occurs because the pip distribution does not
>> include the /scripts folder or the i18n submodule.
>>
>> So my first question is am I just doing something obviously wrong and the
>> i18n submodule should have been available over pip as well?
>>
>> If it's not just me then would it not make sense to have any i18n files
>> necessary to the Pywikibot *library* to also be distributed via the same
>> pip package? (i18n for scripts is another issue since for scripts you
>> cannot use pip).
>>
>> Cheers,
>> André / Lokal_Profil
>>
>> [1] https://github.com/lokal-profil/pywikibot-sdc
>> André Costa | Chief Operating Officer, Wikimedia Sverige |
>> andre.co...@wikimedia.se | +46 (0)733-964574
>>
>> Stöd fri kunskap, bli medlem i Wikimedia Sverige.
>> Läs mer på blimedlem.wikimedia.se
>>
>> ------
>> sent from my mobile, all typos are due to autocorrect ;)
>> _______________________________________________
>> pywikibot mailing list
>> pywikibot@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
>>
> _______________________________________________
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot
>
> _______________________________________________
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot
>
_______________________________________________
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot

Reply via email to