Translations introduction

To localize the menu, include the particular translation .js file after including the jQuery.mmenu .js files.

<head>
   <script src="path/to/jquery.js" type="text/javascript"></script>
   <script src="path/to/jquery.mmenu.min.js" type="text/javascript"></script>
   <script src="path/to/jquery.mmenu.nl.min.js" type="text/javascript"></script>

Add a new translation

The best approach to add a translation, is to create a new translation .js file for the core and each add-on that contains a translatable text.

First, copy one of the already available translation .js files and rename it using the naming convention:

src/core/oncanvas/translations/jquery.mmenu.[language].js

Where [language] refers to the translation language, can be any word but preferred is a two digits language code in lowercase.

For example, a new translation in French would result in the following files:

src/core/oncanvas/translations/jquery.mmenu.fr.js
src/core/screenreader/translations/jquery.mmenu.fr.js
src/addons/searchfield/translations/jquery.mmenu.fr.js

Next, open "gulpfile.js" and add the language to the languages variable.

var language = [ "nl", "de", "fr" ];

Now all you need to do, is run $ gulp in the command-line. Have a look at the custom build page for more info.

If you're using Git, you might want to create a pull request for these changes.

Override translation

If you only want to override a part of an already available translation (or if you think the above method to create a new translation is to difficult), copy and change the contents of an already available translation .js file and paste it in a new file or as inline script.

<head>
   <script src="path/to/jquery.js" type="text/javascript"></script>
   <script src="path/to/jquery.mmenu.min.js" type="text/javascript"></script>
   <script src="path/to/jquery.mmenu.nl.min.js" type="text/javascript"></script>
   <script type="text/javascript">
      (function( $ ) {
         var _PLUGIN_ = 'mmenu';
         $[ _PLUGIN_ ].i18n({
            'Search': 'Doorzoek het menu'
         });
      })( jQuery );
   </script>

To get a list of all translatable texts, invoke the $.mmenu.i18n function.

<script type="text/javascript">
   console.log( $.mmenu.i18n() );
</script>