-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Martin,
I've wrote a smarty plugin, which enables the usage of '%s' in language
strings.
The plugin has two arguments, the first is a language string identifier
(such as 'BASKET_VPE_MESSAGE') and the second one is an array of
replacements. These replacements can be language string IDs too.
Example:
[{assign_adv var="messages" value="array('MF_MESSAGE1', 'Out of order')"}]
[{mfmultilangreplace ident="MF_MESSAGES" replace=$moduleCoreName}]
Content of the language string identifiers:
'MF_MESSAGES' => 'The class returns \'%s\' and \'%s\'!',
'MF_MESSAGE1' => 'Not enough memory',
Send me an email, if you want to get this plugin. ;)
Regards,
Stefan
Am 22.10.2010 13:48, schrieb [email protected]:
> Hello developers!
> We are currently trying to add another language to the shop.
> There we have the following problem:
>
> Let's say in English the text is
> "Only in packaging units of 5"
>
> Now we have the translation in lang.php
> 'BASKET_VPE_MESSAGE' => "Only in packaging units
> of ",
>
> The code in the template:
> [{ oxmultilang ident="BASKET_VPE_MESSAGE" }] [{
> $basketproduct->oxarticles__oxvpe->value}]
>
> Now we have a new language were the sentence is created in a different way,
> so that after the "5" there has to be text as well:
> "This item can only be bought in packaging units that contain 5 items."
> (I used English, not the original new language just for explanation)
> Now you would need something like
> [{ oxmultilang ident="BASKET_VPE_MESSAGE1" }] [{
> $basketproduct->oxarticles__oxvpe->value}] [{ oxmultilang
> ident="BASKET_VPE_MESSAGE2" }]
> in the template and the corresponding entries in lang.php.
> It is quite some work to modify all the places where this issue occurs
> (change the templates and add the 2nd entry to all language files).
>
> What do you think about an extended oxmultilang modifier in smarty that can
> also work with additional attributes?
> Place holders in the multilang string would be replace by these attributes.
> Something like:
>
> [{ oxmultilang ident="BASKET_VPE_MESSAGE"
> value="$basketproduct->oxarticles__oxvpe->value" }]
> (in the tpl)
>
> 'BASKET_VPE_MESSAGE' => "Only in packaging units
> of %s",
> 'BASKET_VPE_MESSAGE' => "This item can only be
> bought in packaging units that contain %s items."
> (in lang.php)
>
> I know this could be achieved somehow with the smarty modifier
> "string_format" as well.
> But I like my idea more ;-)
>
> Is there maybe something like this in the new template system that is
> announced for 4.5.0?
> If yes, it would be great to have this code already now so that I could
> implement it myself for older releases.
>
> Regards,
> Martin
>
>
>
> _______________________________________________
> dev-general mailing list
> [email protected]
> http://dir.gmane.org/gmane.comp.php.oxid.general
- --
Stefan Krenz Mayflower GmbH
Pleichertorstraße 2 Tel.: +49 931 359 65 1163
D-97070 Würzburg Fax : +49 931 359 65 28
[email protected] http://www.mayflower.de
Mayflower GmbH, Standort Würzburg
Firmensitz: Mannhardtstraße 6, 80538 München
Registergericht: Amtsgericht München, HRB 142039
Geschäftsführer: Gregor Streng, Björn Schotte,
Albrecht Günther, Johann-Peter Hartmann
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJMwYUVAAoJEA6jQhpPUdZMvhgH/3neL3defzZa+FmboScAVPza
Kc7ne+pIHNMRZRaqTbBkIaG6t/fa5A5Llu1F+qyvweX8+z3sjAmD4y9891Z+GIKr
X0L1mrMifi+Y9CVm51qpNG8apoFqVTbQ+4xmx6lKjQJlGXgL/7mxRRR8kcuyHDSK
RQKdI0a8XW3MOkWjpfITWE+NNZ8Vzb/mGwgMwo4iG9nL37SmxJLLwjyAo70w3eBv
jPTU27uqw7InUGt61Az1ZrSzHFZxWEf55eSYZmi+EFHKk/z7yP+M979C7fVuT1lX
yHZ58824oBqVjoinGXKweQLdnBB02M8J0j85VrJKbl0/BQ9Fd9PAGI+SOV5KYuo=
=Tk6p
-----END PGP SIGNATURE-----
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general