Localization::setDomain($base);
if ($obj instanceof BlockType) { $bt = $obj; $base = $obj->getBlockTypePath(); } else { $bFilename = $obj->getBlockFilename(); $b = $obj; $base = $b->getBlockPath();
Localization::setDomain($dir . '/' . $btHandle);
/* * Changes the localization file path temporarily * then passes on to concrete's built in translation */ function mypackage_t($text) { Localization::setDomain(DIR_PACKAGES . '/mypackage'); $returnString = ''; if (func_num_args() == 1) { $returnString = gettext($text); } else { $arg = array(); for($i = 1 ; $i < func_num_args(); $i++) { $arg[] = func_get_arg($i); } $returnString = vsprintf(gettext($text), $arg);
function on_start() { Loader::library('mypackage_localization', 'mypackage'); }
pkg_t("My name is %s", "mypackage", $name);
I created a message.po/mo under in my package tree and on top of my views I switched to my mo-file and at the and I switched back to the default one. Does this somehow coincide with the concepts of the core developement?
This works so far, but there are still problems: how can I add translations to the core regarding my package, for example names and descriptions shown in the package list...
has c5 an interface for package localization?? I don't think normal users like to care for po files and conversion stuff etc.