Translating External Tools

Dominik Haumann dhaumann at kde.org
Mon Oct 7 21:59:05 BST 2019


Fixed:
https://invent.kde.org/kde/kate/commit/d10af90957bfce5b7c8b55bb43faf0a7584b9354

Thanks!
Dominik

On Mon, Oct 7, 2019 at 10:36 PM Albert Astals Cid <aacid at kde.org> wrote:

> El dilluns, 7 d’octubre de 2019, a les 22:27:20 CEST, Dominik Haumann va
> escriure:
> > Ok, thanks. Both fixed.
> >
> > Yet, I have another one:
> > I use i18nc("External tools name", name) and i18nc("External tools
> > category", category) to translate external tools. This works for external
> > tools that are shipped by default.
> >
> > However, if the user creates a new tool, the name and category initially
> is
> > empty: i18n("") then returns "(I18N_EMPTY_MESSAGE)" as user visible
> string,
> > which is not what I want.
> >
> > I found on https://api.kde.org/frameworks/ki18n/html/prg_guide.html that
> > "an empty string should never be wrapped with a basic i18n call (no
> i18n("")),
> > because in translation catalog the message with empty text has a special
> > meaning, and is not intended for client use. The behavior of i18n("") is
> > undefined, and there will be some warnings in debug mode."
> >
> > So what's the proper way of using i18n() if the string possibly is empty?
> > Create a helper function "QString myI18n(const QString &)" that only
> calls
> > i18n() if the passed string is non-empty?
>
> Yes.
>
> Cheers,
>   Albert
>
> >
> > Thanks & best regards
> > Dominik
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Sep 23, 2019 at 11:52 PM Albert Astals Cid <aacid at kde.org>
> wrote:
> >
> > > El dilluns, 23 de setembre de 2019, a les 16:12:45 CEST, Dominik
> Haumann
> > > va escriure:
> > > > Hi everyone,
> > > >
> > > > I have some translation-related questions for the external tools
> plugin.
> > > > Currently some things are certainly wrong.
> > > >
> > > > 1. Messages.sh
> > > > We have default tools in a file compiled into Kate, see:
> > > >
> > >
> https://invent.kde.org/kde/kate/blob/master/addons/externaltools/defaultexternaltoolsrc
> > > > In short, this is a ini-like file. Entries that need translation are:
> > > > name=...
> > > > category=...
> > > > The rest must not be translated. Still, I am pretty sure we are
> missing a
> > > > line or so in the Message.sh extraction script:
> > > >
> > >
> https://invent.kde.org/kde/kate/blob/master/addons/externaltools/Messages.sh
> > > >
> > > > Can one of you clarify how to do this properly?
> > >
> > > You're using a custom file format, so you need a custom solution.
> > >
> > > Something with sed/grep/whatever that extracts from that customrc file
> and
> > > appends to rc.cpp
> > >
> > > Also you'll need to call i18n() on whatever thing you read from that rc
> > > file so it actually gets translated.
> > >
> > > >
> > > > 2. ui.rc
> > > > The xmlgui file is located here:
> > > >
> https://invent.kde.org/kde/kate/blob/master/addons/externaltools/ui.rc
> > > > The contents to be discussed is:
> > > > <gui name="externaltools" library="externaltoolsplugin" version="1">
> > > >
> > > > In other plugins, I can also find an attribute "translationDomain",
> e.g.:
> > > > https://invent.kde.org/kde/kate/blob/master/addons/lspclient/ui.rc
> > > >
> > > > My CMakeLists.txt file located at
> > > >
> > >
> https://invent.kde.org/kde/kate/blob/master/addons/externaltools/CMakeLists.txt
> > > > contains this:
> > > > target_compile_definitions(externaltoolsplugin PRIVATE
> > > > TRANSLATION_DOMAIN="kateexternaltoolsplugin")
> > > >
> > > > Am I missing the translationDomain in the ui.rc file?
> > >
> > > Yes, how do you expect the kpart code to know from which domain(aka
> file)
> > > to load the translations when presented with that xml file otherwise?
> > >
> > > Cheers,
> > >   Albert
> > >
> > > >
> > > > Any hints are welcome.
> > > >
> > > > Best regards
> > > > Dominik
> > > >
> > >
> > >
> > >
> > >
> > >
> >
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20191007/828cdfce/attachment.html>


More information about the KWrite-Devel mailing list