Closed jrm-unamur closed 4 years ago
Hi Jean-Roch,
the plugin already supports different languages, it is documents in the plugin settings.
This is from the plugin settings for custom nodes:
Supported language(s) (optional): This setting can be used for displaying the custom node to users of the specified language only. Separate more than one supported language with commas. If the custom node should be displayed in all languages, then leave this field empty.
So you have to define one node per language you want to support.
Cheers Christian
Thanks for prompt answer Christian :-) It works as you said! I knew about language restriction, but shame on me didn't think about adding node for each language. However, IMHO, for platforms using multiple languages, using the built-in get_string function in the rendering code would be more efficient, admins would have to add only one node for all languages... Anyway I'm closing the issue Cheers Jean-Roch
Hey Jean-Roch,
@christianwolters's response is already a solution to your problem. But I would like to come back to you with more feedback.
Yes, you are right. Using get_string would be more efficient for multiple languages than creating one node per language. Creating one node per language only scales as far as you have some nodes and some languages. However, get_string requires that the string is located in the plugin's language pack. And then labels of the custom nodes are not located in the language pack. So, to be able to use the efficiency of get_string, you would have to get the strings into the language pack first. Does not make much sense from my point of view.
But there's another possibility: At the moment, the custom nodes do not support multilang strings (see https://docs.moodle.org/en/Multi-language_content_filter for the core feature or https://moodle.org/plugins/filter_multilang2 for a nicer syntax). It would be easy to push the node name through format_string() to process multilang strings. This would help for all scenarios where you want to support multiple-language nodes but where the node link targets in all languages are the same.
I have implemented this feature now on https://github.com/moodleuulm/moodle-local_boostnavigation/commit/ed280f7f10786f030b1c2fb510168002da6c4d11.
Cheers, Alex
Hi Alex,
AFAIK, node titles cannot be translated into user or course language. Is this functionality in your roadmap?
Cheers
Jean-Roch