Look at yourThe following code a bit closerdoes what you seem to need (screenshots attached). The following modules need to be activated:
- i18n_menu (part of the i18n)
You are addingFurther configuration:
I added a new language (tr) and set language detection to "Determine the language from the URL (Path prefix or domain)."
I added a new menu with machine name (menu-sol-menu) and set the translation mode to "Translate and Localize". Also added the new menu as a block to the header region of the theme.
Added the following code in a custom module and activated it.
function agi_menu() { $items = []; $items['agi'] = [ 'title' => 'AGI (Family Status Declaration)', 'page callback' => 'drupal_get_form', 'page arguments' => ['node_form'], 'access arguments' => ['access content'], 'menu_name' => 'menu-sol-menu' ]; return $items; }
I visited the menu admin page and saw that a new menu item, in every iteration, using was added:
I checked the exact same keylanguage option for that new menu item, 'agi'it was set to neutral. In
I visited the end, your $items
array holds only onehome page of my drupal instance and checked that the menu item appears, for the last language returned by theboth english language_list()
function(default language) and turkish, apparently Turkishusing the URL to define the current language.
P.S.: Below is a rewrite of your codeFinally, withoutI looked in the needtranslate interface for a loopthe title of the menu item. This implies activating
Conclusion: The provided code with the "Content Translation" module from coredescribed configuration works as expected by the OP.
Good luck!
N.B.: Especially for the 'title' and 'title callback' properties, the documentation is very clear about how to use them in a multilingual setting
"title": Required. The untranslated title of the menu item. "title callback": Function to generate the title; defaults to t(). If you require only the raw string to be output, set this to FALSE.
function suweb_agi_menu() {
$items = [];
$items['agi'] = [
'title' => 'AGİ (Family Status Declaration)',
'page callback' => 'drupal_get_form',
'page arguments' => ['suweb_agi_form'],
'access arguments' => ['access content'],
'menu_name' => 'menu-sol-menu'
];
return $items;
}