Can't pluralise certain language strings....

  • Betroffene Version
    WoltLab Suite 3.1

    I have failed to properly localise and pluralise wcf.date.relative.minutes and wcf.date.relative.hours. Thb there could be more strings that behaves exactly like them.

    The correct phrase shows up for a split of the second and then gets replaced by the raw syntax inside the language phrase. That also applies on any other default woltlab template or PHP function. Without subtr I simply can not pluralise the phrase.

    Disabling java-script shows the text as it should be.

    Does anyone knows how to solve it?:/

    • Offizieller Beitrag

    The correct phrase shows up for a split of the second and then gets replaced by the raw syntax inside the language phrase.

    The JavaScript template engine is very limited compared to the server-side engine. As a side effect, the language class will attempt to evaluate the phrase and will return the raw phrase on error. Things like {assign} and {counter} are not supported in the JavaScript template engine.

    Supported functions:

    • if, else, else if and elseif
    • {lang}
    • {implode}
    • {foreach} and {foreachelse}
    • Implicit HTML encoding of variables.
    • Raw HTML output via @ and number formatting via #.
  • Is there any possible workaround apart from editing the core and outputting $hours and $minutes already translated and pluralised before it even reaches {lang}?

    Can java script engine can be extended if so which files are responsible for parsing the syntax?

    It's really sad that woltlab can't handle a basic task like a proper localisation by default...

  • I've already solved it by writing if and else statements while checking '==' to every possible value from 1-60 and 1-24 respectively even though that's a quite messy and more costly approach in terms of loading times.

    You can use raw JavaScript-Code

    It doesn't look like raw javascript is being passed trough {lang} as well unless you meant code inside the templates or something else.

    This is how it looks on attempt to place js inside the phrase:

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!