mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
#1534 (patch by severin.schols) Added support for sprintf(_t()) usage in template for translation
see http://code.google.com/p/google-highly-open-participation-silverstripe/issues/detail?id=29 git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@46155 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9c6a30d363
commit
de30b37795
@ -286,6 +286,10 @@ class SSViewer extends Object {
|
||||
ereg('.*[\/](.*)',$template,$path);
|
||||
$content = ereg_replace('<' . '% +_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\) +%' . '>', '<?= _t(\''. $path[1] . '.\\2\\3\'\\4) ?>', $content);
|
||||
|
||||
// i18n - sprintf => "sprintf(_t(...),$argument)"
|
||||
// CAUTION: No spaces allowed between arguments!
|
||||
$content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>) +%' . '>', '<?= sprintf(_t(\''. $path[1] . '.\\2\\3\'\\4),\\6) ?>', $content);
|
||||
|
||||
// </base> isnt valid html? !?
|
||||
$content = ereg_replace('<' . '% +base_tag +%' . '>', '<base href="<?= Director::absoluteBaseURL(); ?>" />', $content);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user