Source: http://drupal.org/node/763536
Use translation interface to translate the name of the content type. However, there is a bug in i18n. When you click content create, the content names are not translated.
Solution: with following patch.
# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: \sites\all\modules\downloaded\i18n\i18ncontent
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: i18ncontent.module
--- i18ncontent.module Base (BASE)
+++ i18ncontent.module Locally Modified (Based On LOCAL)
@@ -156,13 +156,16 @@
*/
function i18ncontent_menu_alter(&$menu) {
$menu['node/add']['page callback'] = 'i18ncontent_node_add_page';
- // @TODO avoid iterating over every router path.
- foreach ($menu as $path => $item) {
- if (!empty($item['page callback']) && $item['page callback'] == 'node_add') {
+ //fetch valid node types
+ //we just copy the behavior in node_menu()
+ $ntypes = node_get_types('types', NULL, TRUE);
+ foreach ($ntypes as $type) {
+ $type_url_str = str_replace('_', '-', $type->type);
+ $path = 'node/add/' . $type_url_str;
+ if (!empty($menu[$path]['page callback']) && $menu[$path]['page callback'] == 'node_add') {
$menu[$path]['page callback'] = 'i18ncontent_node_add';
- $arg = arg(NULL, $path);
$menu[$path]['title callback'] = 'i18nstrings_title_callback';
- $menu[$path]['title arguments'] = array('nodetype:type:'. $arg[2] .':name', $item['title']);
+ $menu[$path]['title arguments'] = array('nodetype:type:'. $type->type .':name', $type->name);
}
}
}
No comments:
Post a Comment