Project

General

Profile

Mixing tr and trn localized strings in one file

Added by Christian Meyer over 2 years ago

I am trying to update the Titlebar for a Panel with the number of Items that are its children.
That is the real problem, as setTitle only seems to work once, but does not want to be updated.

What I am now trying to work out is using a Localized String, with trn , Using the correct plural or singular form.

But whenever I put a messages region with plural definitions into the same file as where there are just Singular definitions, the file seems to not be recognized...

Or better: The Text.NOW and .LATER messages will not be found and set as ??Text.NOW?? in the Widgets.

<?xml version="1.0" encoding="UTF8"?>
<messages nplurals="2" plurals="n<2 ? 0 : 1">

    <message id="Text.Category.n">
        <plural case="0">Category - {1}</plural>
        <plural case="1">Categories - {1}</plural>
    </message>

    <message id="Text.Track.n">
        <plural case="0">Track - {1}</plural>
        <plural case="1">Tracks - {1}</plural>
    </message>

</messages>

<messages>

<message id="Text.NOW">Now</message>
<message id="Text.LATER">Later</message>

</messages>

I really like to have one file per Language, but if that won't be possible, then I guess I have to just make do with multiples.

Also finding how to create multiple entries was quite a journey from WString::trn to WMessageResourceBundle

Maybe include a Link in the Description of trn ?

Cheers


Replies (3)

RE: Mixing tr and trn localized strings in one file - Added by Roel Standaert over 2 years ago

You can just put the non-pluralized messages together with the others.

<?xml version="1.0" encoding="UTF8"?>
<messages nplurals="2" plurals="n<2 ? 0 : 1">

    <message id="Text.Category.n">
        <plural case="0">Category - {1}</plural>
        <plural case="1">Categories - {1}</plural>
    </message>

    <message id="Text.Track.n">
        <plural case="0">Track - {1}</plural>
        <plural case="1">Tracks - {1}</plural>
    </message>

    <message id="Text.NOW">Now</message>
    <message id="Text.LATER">Later</message>

</messages>

RE: Mixing tr and trn localized strings in one file - Added by Christian Meyer over 2 years ago

Hey, thanks for the Info.

I just tried it it it does not really work...

Can it be, as I use Multiple ResourceBundles that it interferes?

I use one for Widget Templating only and another for the language.

Also I am trying to Modularize, so every Module uses their own set of Resource Bundles

In whitchever file I try to use multiples, all of those message keys can no longer be used

as soon as <messages nplurals="2" plurals="n<2 ? 0 : 1"> is in the file.

Happy Holidays and "guten Rutsch in neue Jahr" =)

RE: Mixing tr and trn localized strings in one file - Added by Christian Meyer over 2 years ago

Of Course it works ...

Sorry for a potential Scare ... reading error logs helps ...

Important are the keywords: nplurals && plural not plurals

    (1-3/3)