jqueryTranslator icon indicating copy to clipboard operation
jqueryTranslator copied to clipboard

Switching back to no language file on click

Open magglomag opened this issue 9 years ago • 5 comments

Hi,

I am using the plugin in a language switcher. My default language is German (the German strings are in my index.html like <h1 data-translate="title">Title in German</h1>) and I have a language file content-en.js for the English translation.

The language can be switched on click:

    $buttonEN.click(function( e ) {
      $( '[data-translate]' ).jqTranslate( 'content', { forceLang: 'en' });
    });

What I now like to achieve is that when I click on $buttonDE not the German language file should be loaded but the normal strings in my index.html. So is there a function to just stop the plugin from loading a language file?

    $buttonDE.click(function( e ) {
      /* The regular strings in my `index.html` should be loaded. */
    });

Thanks for your help!

magglomag avatar Jul 21 '16 12:07 magglomag

Hey, this is currently not possible since text is just replaced and hence, lost. It'd be a good idea to save that text as current language so you can achieve what you imply here.

I might work on this as I'd like to update this plugin to use newer tools and techniques but I can't promise when that might happen.

Antonio-Laguna avatar Jul 21 '16 14:07 Antonio-Laguna

Alright, thanks for the info! So you mean to save the strings in the index.html in a file named content-de.json?

magglomag avatar Jul 21 '16 15:07 magglomag

No, I mean saving it in memory so if the button for German is pressed, the content can be restored.

Antonio-Laguna avatar Jul 21 '16 17:07 Antonio-Laguna

Can you explain that a bit further – I don’t know what you mean with saving it in memory. Thanks!

magglomag avatar Jul 21 '16 20:07 magglomag

May I ask if you could give me a hint on that?

magglomag avatar Jul 28 '16 16:07 magglomag