diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php index 7675320a5..195b3e02c 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php @@ -4,21 +4,43 @@ class Helpers{ public function loadTemplate( $template, $vars = array () ) { global $AMS_LIB; - global $NELTOOL_SITEBASE; + global $SITEBASE; + global $AMS_TRANS; require_once $AMS_LIB . '/smarty/libs/Smarty.class.php'; $smarty = new Smarty; - $smarty -> debugging = true; - $smarty -> caching = true; + // turn smarty debugging on/off + $smarty -> debugging = false; + // caching must be disabled for multi-language support + $smarty -> caching = false; $smarty -> cache_lifetime = 120; if ( !helpers :: check_if_game_client () ){ - $smarty -> template_dir = $AMS_LIB . '/templates/'; - $smarty->setConfigDir($AMS_LIB .'/config'); + $smarty -> template_dir = $AMS_LIB . '/ingame_templates/'; + $smarty -> setConfigDir( $AMS_LIB . '/configs' ); }else{ - $smarty -> template_dir = $NELTOOL_SITEBASE . '/templates/'; - $smarty->setConfigDir($NELTOOL_SITEBASE .'/config'); + $smarty -> template_dir = $SITEBASE . '/templates/'; + $smarty -> setConfigDir( $SITEBASE . '/configs' ); + } + + foreach ( $vars as $key => $value ){ + $smarty -> assign( $key, $value ); + } + if ( isset( $_GET["language"] ) ){ + $language = $_GET["language"]; + if ( file_exists( $AMS_TRANS . '/' . $language . '.ini' ) ){ + + }else{ + global $DEFAULT_LANGUAGE; + $language = $DEFAULT_LANGUAGE; + } + }else{ + global $DEFAULT_LANGUAGE; + $language = $DEFAULT_LANGUAGE; + } + $variables = parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true ); + foreach ( $variables[$template] as $key => $value ){ + $smarty -> assign( $key, $value ); } - $smarty -> assign( "option_selected", "NE" ); $smarty -> display( $template . '.tpl' ); } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ams_lib.conf b/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ams_lib.conf index 5eac748ec..b9e919045 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ams_lib.conf +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ams_lib.conf @@ -1,5 +1,3 @@ title = Welcome to Smarty! cutoff_size = 40 -[setup] -bold = true diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.phtml b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.phtml index 08a6835bd..dd1efbef8 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.phtml +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.phtml @@ -5,7 +5,6 @@