Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed a bug #1641

Merged
merged 1 commit into from

2 participants

ZippoLag dingpinglv
ZippoLag

cc.Application.getCurrentLanguage was always returning cc.LANGUAGE_ENGLISH.

ZippoLag ZippoLag Fixed a bug
cc.Application.getCurrentLanguage was always returning cc.LANGUAGE_ENGLISH.
c09a1ca
dingpinglv dingpinglv merged commit 4cf7996 into from
ZippoLag ZippoLag deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2014
  1. ZippoLag

    Fixed a bug

    ZippoLag authored
    cc.Application.getCurrentLanguage was always returning cc.LANGUAGE_ENGLISH.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 4 deletions.
  1. +7 −4 cocos2d/core/platform/CCApplication.js
11 cocos2d/core/platform/CCApplication.js
View
@@ -394,14 +394,17 @@ cc.Application.getCurrentLanguage = function () {
var ret = cc.LANGUAGE_ENGLISH;
var currentLang = navigator.language;
- if(!currentLang)
+ if(!currentLang){
currentLang = navigator.browserLanguage || navigator.userLanguage;
- if(!currentLang)
+ }
+ if(!currentLang){
return ret;
+ }
- currentLang = currentLang.toLowerCase();
+ currentLang = currentLang.substring(0,2).toLowerCase();
switch (currentLang) {
- case "zh-cn":
+ case "cn":
+ case "zh":
ret = cc.LANGUAGE_CHINESE;
break;
case "fr":
Something went wrong with that request. Please try again.