Hi again,
it looks like that mail attachments are generally droped by mailman. So
I post the source in this mail.
--- cut here ---
<?php
/**
* Smarty function
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
require_once "function.oxmultilang.php";
/**
* Loads a langauge string and replaces %s with the specified args.
*
* @param array $params Pluginparameters
* @param object &$smarty Templateengine object.
*
* @return string
*/
function smarty_function_mfmultilangreplace( $params, &$smarty )
{
startProfile("smarty_function_mfmultilangreplace");
$sIdent = isset( $params['ident'] ) ? $params['ident'] : 'IDENT
MISSING';
$sInputString = smarty_function_oxmultilang(array('ident' =>
$sIdent), $smarty);
$sprintfParams = array($sInputString);
foreach ($params['replace'] as $replacement) {
$sReplacement = smarty_function_oxmultilang(array(
'ident' => $replacement,
'noerror' => true,
), $smarty);
if ($sReplacement == $replacement) {
$sprintfParams[] = $replacement;
} else {
$sprintfParams[] = $sReplacement;
}
}
return call_user_func_array('sprintf', $sprintfParams);
}
--- cut here ---
Have a nice weekend and a good usage of this code.
Regards,
Stefan
Am 22.10.2010 15:55, schrieb Stefan Krenz:
> No I didn't, but with this mail I try it.
>
> Greets,
> Stefan
>
> Am 22.10.2010 15:54, schrieb Marco Steinhaeuser:
>> Hi Stefan,
>>
>> Great! Unless the attachment was probably filtered by mailman. Did you try
>> sending it as a zip?
>>
>> Regards
>> Marco
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: [email protected]
>> [mailto:[email protected]] Im Auftrag von Stefan Krenz
>> Gesendet: Freitag, 22. Oktober 2010 15:48
>> An: [email protected]
>> Betreff: Re: [oxid-dev-general] Problem with translation of phrasesin
>> differentlanguages
>>
>> Hi again,
>>
>> until this functionally is implemented, here is my smarty plugin
>> (attachment).
>>
>> Have a nice weekend.
>>
>> Regards,
>> Stefan
>>
>> Am 22.10.2010 15:37, schrieb Sarunas Valaskevicius:
>>> Hi,
>>>
>>> this is a good idea and we will consider it, currently there is no
>>> such functionality implemented.
>>>
>>> Regards,
>>> Sarunas
>>>
>>>
>>> ----- Original Message ----- From: <[email protected]>
>>> To: <[email protected]>
>>> Sent: Friday, October 22, 2010 2:48 PM
>>> Subject: [oxid-dev-general] Problem with translation of phrases in
>>> differentlanguages
>>>
>>>
>>>> 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
>>>>
>>> _______________________________________________
>>> dev-general mailing list
>>> [email protected]
>>> http://dir.gmane.org/gmane.comp.php.oxid.general
>
>
> _______________________________________________
> 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 11 63
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
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general