Skip to content
Snippets Groups Projects
Commit 9f0c0bfc authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

NEW Introduce hidden option MAIN_REPLACE_TRANS_xx_XX to allow simple

replacement of translated string on the fly.
parent a84ec64e
No related branches found
No related tags found
No related merge requests found
<?php
/* Copyright (C) 2001 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2012 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
......@@ -579,6 +579,19 @@ class Translate
{
$str=$this->tab_translate[$key];
// Make some string replacement after translation
$replacekey='MAIN_REPLACE_TRANS_'.$this->defaultlang;
if (! empty($conf->global->$replacekey)) // Replacement translation variable with string1:newstring1,string2:newstring2
{
// Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX
$tmparray=explode(';', $conf->global->$replacekey);
foreach($tmparray as $tmp)
{
$tmparray2=explode(':',$tmp);
$str=preg_replace('/'.preg_quote($tmparray2[0]).'/',$tmparray2[1],$str);
}
}
if (! preg_match('/^Format/',$key))
{
//print $str;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment