我怎样才能获得Parsley.js的语言环境

时间:2016-11-29 13:19:23

标签: javascript jquery localization parsley.js

虽然在后端定义Parsley的区域设置 ,但是:

+-----------+-----------+---------------------+---------------------------------+------------+------------+
| ServiceID | PathOrder |        Date         |            Location             | Lattitude  | Longitude  |
+-----------+-----------+---------------------+---------------------------------+------------+------------+
|     48322 |         1 | 28/11/2016 05:38:37 | Weaver Road,Leicester           | 52.5753273 |  -1.306842 |
|     48322 |         2 | 28/11/2016 05:40:02 | Earl Street,Leicester           |    52.5781 | -1.3048711 |
|     48322 |         3 | 28/11/2016 05:44:05 | Earl Street,Leicester           | 52.5780996 | -1.3048768 |
|     48322 |         4 | 28/11/2016 05:53:52 | Arbor Road,Leicester            | 52.5533448 | -1.2349645 |
|     48322 |         5 | 28/11/2016 09:14:25 | Arbor Road,Leicester            | 52.5533833 | -1.2349445 |
|     48322 |         6 | 28/11/2016 09:15:54 | Coventry Road,Leicester         | 52.5522865 | -1.2370495 |
|     48322 |         7 | 28/11/2016 09:16:05 | Coventry Road,Leicester         |  52.552292 | -1.2370598 |
|     48322 |         8 | 28/11/2016 09:20:41 | Arbor Road,Leicester            |  52.553338 | -1.2352033 |
|     48322 |         9 | 28/11/2016 13:34:36 | Arbor Road,Leicester            |  52.553388 | -1.2352651 |
|     48322 |        10 | 28/11/2016 13:53:29 | Narborough Road South,Leicester |  52.597422 | -1.1832976 |
|     48322 |        11 | 28/11/2016 13:55:36 | Narborough Road South,Leicester |  52.597352 |  -1.183299 |
|     48322 |        12 | 28/11/2016 13:58:51 | Hazel Drive,Leicester           | 52.6020946 | -1.1760238 |
|     48322 |        13 | 28/11/2016 14:11:53 | Hazel Drive,Leicester           | 52.6020853 | -1.1760053 |
|     48322 |        14 | 28/11/2016 14:24:40 | Arbor Road,Leicester            | 52.5533118 | -1.2352118 |
|     48322 |        15 | 28/11/2016 14:29:48 | Arbor Road,Leicester            | 52.5532741 | -1.2352471 |
|     48322 |        16 | 28/11/2016 14:30:39 | Coventry Road,Leicester         |  52.552955 | -1.2363475 |
|     48322 |        17 | 28/11/2016 14:32:24 | Coventry Road,Leicester         |  52.552944 | -1.2363491 |
|     48322 |        18 | 28/11/2016 14:34:06 | Coventry Road,Leicester         | 52.5532598 | -1.2350731 |
|     48322 |        19 | 28/11/2016 14:50:12 | Coventry Road,Leicester         | 52.5532646 | -1.2351661 |
|     48322 |        20 | 28/11/2016 14:50:13 | Coventry Road,Leicester         | 52.5532646 | -1.2351661 |
|     48322 |        21 | 28/11/2016 16:02:29 | Coventry Road,Leicester         |  52.553156 | -1.2348643 |
|     48322 |        22 | 28/11/2016 16:13:09 | Earl Street,Leicester           | 52.5780946 |   -1.30486 |
|     48322 |        23 | 28/11/2016 16:22:07 | Earl Street,Leicester           | 52.5780776 |  -1.304851 |
|     48322 |        24 | 28/11/2016 16:23:26 | Weaver Road,Leicester           | 52.5753643 |  -1.306814 |
+-----------+-----------+---------------------+---------------------------------+------------+------------+

如何使用javascript / jquery获取前端中的区域设置值(例如' de'例如)

我尝试了像getLocale()这样的函数......但它似乎没有用。

注意:我无法访问后端。

1 个答案:

答案 0 :(得分:1)

<script src="jquery.js"></script>
<script src="i18n/fr.js"></script>
<script src="i18n/it.js"></script>
<script src="parsley.min.js"></script>
<script type="text/javascript">
   window.ParsleyValidator.setLocale('fr');
</script>

Source