<?php // Change this to the correct path if required require_once "amslib/Amslib.php"; Amslib_Debug::showErrors(); // If you need language support, follow this pattern Amslib_Router_Language::add("en_GB", "en", true); Amslib_Router_Language::add("es_ES", "es"); Amslib_Router_Language::initialise("en"); // Here we create a normal router object $xml = Amslib_Router::getObject("source:xml"); $xml->load("amslib_router.xml"); Amslib_Router::setSource($xml); Amslib_Router::execute(); // This is how to obtain the language catalogue, using the language system linked ot the router $locale = Amslib_Translator_XML::getInstance(); $locale->load("translations/" . Amslib_Router_Language::getCode() . ".xml", true); // Get the resource from the route detected $resource = $router->getResource(); // Here you should put what you need to do in order to complete the work
/** * method: installLanguages * * todo: write documentation */ protected function installLanguages($name, $lang) { foreach ($lang["language"] as $langCode) { // If there was a "router" parameter, insert all the languages into the router system if (isset($lang["router"])) { Amslib_Router_Language::add($langCode, str_replace("_", "-", $langCode)); } // Now register all the languages with the application Amslib_Plugin_Application::registerLanguage($name, $langCode); } }