My proposal? (or my 2 cents to the "Component Admin menus localization" or "CAML")
3rd party developers should use language files to translate menu names (at least at install time)
- When installing a component the menu names sould be created from the language file for that component (reporting the standard language for the site).
That is the solution that I found at component Jbook
jbook
http://extensions.joomla.org/component/ ... Itemid,35/
They still use the XML statment:
Code: Select all
<administration>
<menu>Catalogo libri</menu>
<submenu>
<menu link="option=com_jbook§ion=categories">Categorie</menu>
<menu link="option=com_jbook§ion=auth">Autori</menu>
<menu link="option=com_jbook§ion=editor">Editori</menu>
<menu link="option=com_jbook§ion=book">Libri</menu>
<menu link="option=com_jbook§ion=com">Commenti</menu>
<menu link="option=com_jbook§ion=export">Esportazione XML libri</menu>
<menu link="option=com_jbook§ion=import">Importazione XML libri</menu>
<menu link="option=com_jbook§ion=settings">Settings</menu>
</submenu>
but then they use the file install.jbook.php with the code:
Code: Select all
<?php
function com_install()
{
// db operations
global $database,$mosConfig_absolute_path,$mosConfig_lang;
if (file_exists( $mosConfig_absolute_path ."/administrator/components/com_jbook/language/{$mosConfig_lang}.php" )) {
include_once( $mosConfig_absolute_path ."/administrator/components/com_jbook/language/{$mosConfig_lang}.php" );
} else {
include_once( $mosConfig_absolute_path ."/administrator/components/com_jbook/language/italian.php" );
}
$database -> setQuery("UPDATE #__components SET admin_menu_img = 'js/ThemeOffice/document.png', name = '"._MODULE_NAME."' WHERE name= 'Catalogo libri'");
print "<ol><li> remove admin menu images";
$database -> query();
print "<li> add new admin menu images</ol>";
$database -> setQuery("UPDATE #__components SET admin_menu_img = 'js/ThemeOffice/document.png', name = '"._BOOKS."' WHERE admin_menu_link='option=com_jbook§ion=book'");
$database -> query();
$database -> setQuery("UPDATE #__components SET admin_menu_img = 'js/ThemeOffice/users.png', name = '"._AUTHORS."' WHERE admin_menu_link='option=com_jbook§ion=auth'");
$database -> query();
$database -> setQuery("UPDATE #__components SET admin_menu_img = 'js/ThemeOffice/language.png', name = '"._EDITORS."' WHERE admin_menu_link='option=com_jbook§ion=editor'");
$database -> query();
$database -> setQuery("UPDATE #__components SET admin_menu_img = 'js/ThemeOffice/categories.png', name = '"._CATEGORIES."' WHERE admin_menu_link='option=com_jbook§ion=categories'");
$database -> query();
$database -> setQuery("UPDATE #__components SET admin_menu_img = 'js/ThemeOffice/content.png', name = '"._COMMENTS."' WHERE admin_menu_link='option=com_jbook§ion=com'");
$database -> query();
$database -> setQuery("UPDATE #__components SET name = '"._EXPORT."' WHERE admin_menu_link='option=com_jbook§ion=export'");
$database -> query();
$database -> setQuery("UPDATE #__components SET admin_menu_img = 'js/ThemeOffice/content.png', name = '"._IMPORT."' WHERE admin_menu_link='option=com_jbook§ion=import'");
$database -> query();
$database -> setQuery("UPDATE #__components SET admin_menu_img = 'js/ThemeOffice/config.png', name = '"._SETTINGS."' WHERE admin_menu_link='option=com_jbook§ion=settings'");
$database -> query();
}
?>
This way the names used for component admin menus are stated at the site default language for the component on strings like
Code: Select all
DEFINE ('_EXPORT', 'Exportar');
DEFINE ('_IMPORT', 'Importar');
I think its a good solution, maybe just a little bit more specific strings (to have the language files a little bit mode cleaned up)
Code: Select all
DEFINE ('_ADMINMENU_IMPORT', 'Importar');
-
Tweek the code
I'm not a programmer and don't know if the code could be improved. It would be a nice feature to give 3d party developers a standard code!