语言环境语言检测和翻译? [英] Locale language detection and translation?

查看:100
本文介绍了语言环境语言检测和翻译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Dreamweaver上构建一个脱机的多页移动应用程序,并且我试图使其运行,以便该应用程序只能检测某些<h1>并将其翻译为用户电话设置为的语言环境,但是我不知道怎么.在下面,我希望将顶部的<h1>转换为用户的区域设置语言,而底部的<h1>保留为英语.

I am building an offline multi-page mobile application on Dreamweaver, and I am trying to make it so that the application can detect only certain <h1>s and translate them to the locale language the users phone is set to, but I do not know how. below, I want the top <h1> to be translated to the users locale language, while leaving the bottom <h1> in English.

//html

<h1 class="TopText" id="HouseT">Apartment</h1>
<img src"~"/>
<h1 class="BotText" id="HouseB">Apartment</h1>

推荐答案

使用jQuery,您可以编写一个选择器,该选择器与第一个h1元素匹配,但与第二个元素不匹配.例如:

Using jQuery you could write a selector, that matches the first h1 element, but not the second. For example:

'h1.TopText'(选择具有ToText类属性的h1元素)或'h1#HouseT'(选择具有HouseT作为id的h1元素),然后继续操作其内容.

'h1.TopText' (select h1 elements having ToText class attribute) or 'h1#HouseT' (selecting h1 elements having HouseT as id) and then go on and manipulate it's contents.

这是一个有效的示例:

$('h1.TopText').html('some other text');

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<h1 class="TopText" id="HouseT">Apartment</h1>
<img src"http://placehold.it/100x100"/>
<h1 class="BotText" id="HouseB">Apartment</h1>

这篇关于语言环境语言检测和翻译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆