Jump to content

How to Enable Multiple Languages


xvids

Recommended Posts

  • 8 months later...

Hi,

I have enabled languages in theme.

 

its now render html:

<div class="dropdown-content">
        <ul>
        <li class="list_item" data-value="">
            <a>
                <img data-icon="true" src="https://www.kvs-demo.com/static/images/flags/us.png" alt="GB" width="28" height="20">
                <span>English</span>
            </a>
        </li>

</ul>

I don't want to expose URL parameter, when click on it.

 

how I can do that via Jquery Please help!

 

$('.dropdown-content li').click(function() {

	$.cookie(kt_lang, value, {path: '/'});
	window.location.reload();
	if (typeof(Storage) !== 'undefined') {
		sessionStorage.clear();
	}
});

 

Thanks.

Link to comment
Share on other sites

<div class="languages">	
		{{if $config.locale==''}}
		<img src="{{$config.statics_url}}/static/images/flags/us.png" alt="GB" width="28" height="20">
		<span>English</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='zh'}}
		<img src="{{$config.statics_url}}/static/images/flags/zh.png" alt="ZH" width="28" height="20">
		<span>中文</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='ru'}}
		<img src="{{$config.statics_url}}/static/images/flags/ru.png" alt="RU" width="27" height="20">
		<span>Русский</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='tr'}}
		<img src="{{$config.statics_url}}/static/images/flags/tr.png" alt="TR" width="27" height="20">
		<span>Türkçe</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='de'}}
		<img src="{{$config.statics_url}}/static/images/flags/de.png" alt="DE" width="27" height="20">
		<span>Deutsch</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='ja'}}
		<img src="{{$config.statics_url}}/static/images/flags/ja.png" alt="DE" width="27" height="20">
		<span>日本語</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='pt'}}
		<img src="{{$config.statics_url}}/static/images/flags/pt.png" alt="DE" width="27" height="20">
		<span>Português</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='es'}}
		<img src="{{$config.statics_url}}/static/images/flags/es.png" alt="DE" width="27" height="20">
		<span>Español</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='it'}}
		<img src="{{$config.statics_url}}/static/images/flags/it.png" alt="DE" width="27" height="20">
		<span>Italiano</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='fr'}}
		<img src="{{$config.statics_url}}/static/images/flags/fr.png" alt="DE" width="27" height="20">
		<span>Français</span><div class="arowup"></div>
		{{/if}}
		
		</div>
		<div class="dropdown-content">
		<ul>
		<li class="list_item" data-value="" {{if $config.locale==''}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=en">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/us.png" alt="GB" width="28" height="20">
				<span>English</span>
			</a>
		</li>
		<li class="list_item" data-value="de" {{if $config.locale=='de'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=de">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/de.png" alt="DE" width="26" height="20">
				<span>Deutsch</span>
			</a>
		</li>
		<li class="list_item" data-value="fr" {{if $config.locale=='fr'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=fr">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/fr.png" alt="FR" width="26" height="20">
				<span>Français</span>
			</a>
		</li>
		<li class="list_item" data-value="it" {{if $config.locale=='it'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=it">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/it.png" alt="IT" width="27" height="20">
				<span>Italiano</span>
			</a>
		</li>
		<li class="list_item" data-value="es" {{if $config.locale=='es'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=es">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/es.png" alt="ES" width="26" height="20">
				<span>Español</span>
			</a>
		</li>
		<li class="list_item" data-value="pt" {{if $config.locale=='pt'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=pt">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/pt.png" alt="PT" width="26" height="20">
				<span>Português</span>
			</a>
		</li>
		<li class="list_item" data-value="ru" {{if $config.locale=='ru'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=ru">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/ru.png" alt="RU" width="27" height="20">
				<span>Русский</span>
			</a>
		</li>
		<li class="list_item" data-value="tr" {{if $config.locale=='tr'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=tr">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/tr.png" alt="TR" width="27" height="20">
				<span>Türkçe</span>
			</a>
		</li>
		<li class="list_item" data-value="zh" {{if $config.locale=='zh'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=zh">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/zh.png" alt="ZH" width="28" height="20">
				<span>中文</span>
			</a>
		</li>
		<li class="list_item" data-value="ja" {{if $config.locale=='ja'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=ja">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/ja.png" alt="JA" width="27" height="20">
				<span>日本語</span>
			</a>
		</li>
		</ul>
		</div>

 

Link to comment
Share on other sites

  • 1 year later...
On 2/21/2021 at 3:33 PM, xvids said:
<div class="languages">	
		{{if $config.locale==''}}
		<img src="{{$config.statics_url}}/static/images/flags/us.png" alt="GB" width="28" height="20">
		<span>English</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='zh'}}
		<img src="{{$config.statics_url}}/static/images/flags/zh.png" alt="ZH" width="28" height="20">
		<span>中文</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='ru'}}
		<img src="{{$config.statics_url}}/static/images/flags/ru.png" alt="RU" width="27" height="20">
		<span>Русский</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='tr'}}
		<img src="{{$config.statics_url}}/static/images/flags/tr.png" alt="TR" width="27" height="20">
		<span>Türkçe</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='de'}}
		<img src="{{$config.statics_url}}/static/images/flags/de.png" alt="DE" width="27" height="20">
		<span>Deutsch</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='ja'}}
		<img src="{{$config.statics_url}}/static/images/flags/ja.png" alt="DE" width="27" height="20">
		<span>日本語</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='pt'}}
		<img src="{{$config.statics_url}}/static/images/flags/pt.png" alt="DE" width="27" height="20">
		<span>Português</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='es'}}
		<img src="{{$config.statics_url}}/static/images/flags/es.png" alt="DE" width="27" height="20">
		<span>Español</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='it'}}
		<img src="{{$config.statics_url}}/static/images/flags/it.png" alt="DE" width="27" height="20">
		<span>Italiano</span><div class="arowup"></div>
		{{/if}}
		
		{{if $config.locale=='fr'}}
		<img src="{{$config.statics_url}}/static/images/flags/fr.png" alt="DE" width="27" height="20">
		<span>Français</span><div class="arowup"></div>
		{{/if}}
		
		</div>
		<div class="dropdown-content">
		<ul>
		<li class="list_item" data-value="" {{if $config.locale==''}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=en">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/us.png" alt="GB" width="28" height="20">
				<span>English</span>
			</a>
		</li>
		<li class="list_item" data-value="de" {{if $config.locale=='de'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=de">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/de.png" alt="DE" width="26" height="20">
				<span>Deutsch</span>
			</a>
		</li>
		<li class="list_item" data-value="fr" {{if $config.locale=='fr'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=fr">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/fr.png" alt="FR" width="26" height="20">
				<span>Français</span>
			</a>
		</li>
		<li class="list_item" data-value="it" {{if $config.locale=='it'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=it">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/it.png" alt="IT" width="27" height="20">
				<span>Italiano</span>
			</a>
		</li>
		<li class="list_item" data-value="es" {{if $config.locale=='es'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=es">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/es.png" alt="ES" width="26" height="20">
				<span>Español</span>
			</a>
		</li>
		<li class="list_item" data-value="pt" {{if $config.locale=='pt'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=pt">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/pt.png" alt="PT" width="26" height="20">
				<span>Português</span>
			</a>
		</li>
		<li class="list_item" data-value="ru" {{if $config.locale=='ru'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=ru">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/ru.png" alt="RU" width="27" height="20">
				<span>Русский</span>
			</a>
		</li>
		<li class="list_item" data-value="tr" {{if $config.locale=='tr'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=tr">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/tr.png" alt="TR" width="27" height="20">
				<span>Türkçe</span>
			</a>
		</li>
		<li class="list_item" data-value="zh" {{if $config.locale=='zh'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=zh">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/zh.png" alt="ZH" width="28" height="20">
				<span>中文</span>
			</a>
		</li>
		<li class="list_item" data-value="ja" {{if $config.locale=='ja'}}data-selected="true"{{/if}}>
			<a href="{{$page_canonical|default:$config.project_url}}?kt_lang=ja">
				<img data-icon="true" src="{{$config.statics_url}}/static/images/flags/ja.png" alt="JA" width="27" height="20">
				<span>日本語</span>
			</a>
		</li>
		</ul>
		</div>

 

Excuse me, where is this file path or you created by yourself ?

On 2/22/2021 at 12:13 PM, Tech Support said:

Please try this code:

$('.dropdown-content li').click(function() {
	$.cookie('kt_lang', $(this).attr('data-value'), {path: '/'});
	window.location.reload();
	if (typeof(Storage) !== 'undefined') {
		sessionStorage.clear();
	}
});

 

Excuse me, where do you put this into ? Which file ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...