Marc Posted November 3, 2015 Share Posted November 3, 2015 I am developing a module called 'callcenter', which adds custom menu items to the admin panel. In ProcessCallcenter.info.php a have my navigation setup as follows: 'nav' => array( array( 'url' => 'enterorder/', 'label' => __('Enter order'), 'icon' => 'glass', 'permission' => 'call-prepare', ),array( 'url' => 'enteruser/', 'label' => __('Enter user'), 'icon' => 'glass', 'permission' => 'call-prepare', ), array( 'url' => 'entercall/', 'label' => __('Enter call'), 'icon' => 'glass', 'permission' => 'call-prepare', ), array( 'url' => 'calloverview/', 'label' => __('Call overview'), 'icon' => 'glass', ), ) The labels should be translated, but it does not work. I went to 'languages' in the admin, added ProcessCallcenter.info.php to my language, which found the four label strings, but after translating only the original English labels are displayed in the custom dropdown menu. Other files of my module are translated correctly using this method. Am I doing something wrong? I tried refreshing the modules a few times but it does not help. I attached a screenshot to show what I mean. I have my profile language set to Dutch, so the admin is Dutch except for my module menu (called 'callcenter') which is in English for a reason I don't understand. Link to comment Share on other sites More sharing options...
tpr Posted November 3, 2015 Share Posted November 3, 2015 Is your admin running non-English? Link to comment Share on other sites More sharing options...
Marc Posted November 4, 2015 Author Share Posted November 4, 2015 Is your admin running non-English? Yes it is, it is set to Dutch. I clarified my post by adding a screenshot. Link to comment Share on other sites More sharing options...
tpr Posted November 4, 2015 Share Posted November 4, 2015 I remember a similar issue with the Reno theme (though maybe wrongly), have you tried with the default theme? Link to comment Share on other sites More sharing options...
Marc Posted November 4, 2015 Author Share Posted November 4, 2015 Yup, tried with the default theme as well, same problem. Link to comment Share on other sites More sharing options...
ryan Posted November 5, 2015 Share Posted November 5, 2015 I'm assuming this is a Process module, since that's the only one that supports nav arrays. The arrays provided in your getModuleInfo (like the 'nav' array) are not called at runtime, instead they are stored in the DB. As a result, there's no reason to make those labels translatable–actually you should avoid it, otherwise the wrong language translation might end up stored in the DB. Instead, just make them regular strings like 'Enter Order' rather than __('Enter Order'). Then, somewhere else in your module, make them translatable. It can even be in a PHP comment. For instance, you could add this at the top of your module file: /* * __('Enter Order'); * __('Enter User'); * and so on... * */ These should be in your 'default' language. Make sure the phrases are identical to those in your 'nav' array. Doing this just ensures that the language parser knows they are translatable phrases. After making that change, do a Modules > Refresh, then go back and translate the file (Setup > Languages > language > your file), and save. Now it should work. If using AdminThemeReno, it won't work, unless you upgrade to the latest dev version. I just fixed that issue in AdminThemeReno yesterday actually. Since it looks like you are using Reno, you'll want to grab the latest dev branch. 2 Link to comment Share on other sites More sharing options...
renobird Posted November 5, 2015 Share Posted November 5, 2015 Thanks Ryan. Link to comment Share on other sites More sharing options...
Marc Posted November 5, 2015 Author Share Posted November 5, 2015 Thank you Ryan, that just totally worked, including the Reno theme after updating to the latest dev version. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now