Translation support in Qt-translation-based frameworks

Albert Astals Cid aacid at kde.org
Mon Apr 7 20:34:44 UTC 2014


El Dilluns, 7 d'abril de 2014, a les 05:05:06, Aurélien Gâteau va escriure:
> On Wed, Apr 2, 2014, at 15:31, Albert Astals Cid wrote:
> > El Dimecres, 2 d'abril de 2014, a les 07:42:07, Aurélien Gâteau va
> > 
> > escriure:
> > > > > Having said that, it is a problem when testing packages for nightly
> > > > > builds (a much better way to test translations), which I assume are
> > > > > not
> > > > > built from tarballs with translations.
> > > > 
> > > > There is not such a thing as "tarballs with translations" at this
> > > > stage,
> > > > is there? Of course the frameworks tarballs should include their own
> > > > translations IMHO but AFAIK this is still not done.
> > > 
> > > True. I have a task for this on the framework l10n wiki page
> > > 
> > > https://community.kde.org/Frameworks/Epics/KF5.0_Release_Preparation/l10
> > > n
> > > 
> > > > > > Any way we can make the old "just compile your l10n-kde4 language
> > > > > > and
> > > > > > install
> > > > > > it" way work?
> > > > > 
> > > > > The cmake code can be changed to always build the .qm loader.
> > > > 
> > > > Which code?
> > > 
> > > There is a new function in ecm to build .qm files from the .po files and
> > > generate a .cpp file to autoload the translation. I modified the root
> > > CMakeLists.txt of all qt-based frameworks to use it if a "po" directory
> > > exists.
> > > 
> > > I experimented with this today and made the function work even if the po
> > > directory does not exist. In this case it only creates the .cpp file
> > > (these changes have not been committed yet).
> > > Having thought about it, I prefer it this way in all cases: I don't like
> > > much the idea of having different code produced depending on whether the
> > > po directory is there or not. Always generating the .cpp file feels
> > > better.
> > > 
> > > > > This way
> > > > > you can build the .qm separately. It would still require the step
> > > > > "compile your l10n-kde4 language and install" to know that this
> > > > > particular .po needs to be turned into a .qm, not a .mo. Any ideas
> > > > > how
> > > > > to do that?
> > > > 
> > > > If the .pot contains
> > > > "X-Qt-Contexts: true\n"
> > > > it's quite probable it needs it, the problem for that it's that you're
> > > > going to need to have the templates folder besides your language
> > > > folder
> > > > My understanding is that .po files should still have this, but somehow
> > > > the few files i found don't seem to have it :S
> > > > 
> > > > Not sure if it's because maybe they're autogenerated from other .po
> > > > files
> > > 
> > > Sorry, I don't understand what you mean with the "templates folder".
> > 
> > http://websvn.kde.org/trunk/l10n-kde4/templates
> > 
> > As discussed in IRC it seems that the fact that some translations of .pot
> > files that have
> > "X-Qt-Contexts: true\n"
> > do not have them is more an artifact on how those files where created
> > than
> > what lokalize or other tools do so we've decided that we'll rely on
> > "X-Qt-Contexts: true\n"
> > being present to decide if we have to convert it to .ts and .qm for
> > installing
> > or not.
> > 
> > Also a checker for scripty needs to be done to complain if a given .pot
> > file
> > has "X-Qt-Contexts: true\n" but a language one does not.
> > 
> > Aurelien do you think you can take care of both?
> 
> I assume the former (building a .qm depending on the presence of
> X-Qt-Contexts) has to be done in scripts/autogen.sh. I can probably do
> it (is it OK to reformat the code before, inconsistent indentation makes
> it difficult to work with).

Makes sense.

> Regarding scripty checker, I can probably do it, but I have no idea what
> code is responsible for this, and how it is run. I could not find any
> doc about this on techbase.

See how scripts/update_translations calls

    echo "%% Finding po without pot begin"
    bash ./scripts/find_po_without_pot.sh --silent
    echo "%% Finding po without pot end"

You can do the same with

    echo "%% Checking all .po from .qm files have X-Qt-Contexts begin"
    bash ./scripts/check_po_from_qm_qt_context.sh --silent
    echo "%% Checking all .po from .qm files have X-Qt-Contexts end"

And that script just have to complain to the commandline when finding 
something wrong like find_po_without_pot does.

Cheers,
  Albert

> 
> Aurélien
> _______________________________________________
> Kde-frameworks-devel mailing list
> Kde-frameworks-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-frameworks-devel



More information about the Kde-frameworks-devel mailing list