• 管理员
  •  
    Support Ukraine
    If you experience any problems with the forum (it is not visible, there is no way to post messages, or some functionality does not work), please let us know. If you have problems with registration or you did not receive confirmation letter, let us know and we will activate your account manually.
    If you get an "The submitted form was invalid. Try submitting again" error, delete cookies, then try again.
     

Guide: Getting locale effortlessly

Archive closed topics

版主: Internal errorWatchmens

主题已锁定
头像
jellynettle
WF maker
帖子: 7
注册时间: 28 9月 2019, 20:30
Has thanked: 2 time
Been thanked: 5 time
联系:

Guide: Getting locale effortlessly

帖子 jellynettle »

w3schools dot com/jsref/jsref_tolocalestring.asp

Basically just plop this in browser's console and you have locales you specified in first line in form specified by 'long' (see reference above).

代码: 全选

var locales = ['sk-SK', 'en-US', 'cs-CZ', 'pl-PL', 'hr-HR', 'es-ES', 'pt-BR', 'fr-FR', 'hu-HU', 'de-DE', 'tr-TR', 'sl-SI', 'ru-RU', 'uk-UA'];
days='"'
for (var i in locales){
	for (var j=4; j<11; j++){
		d = new Date(86400000*j);
		days += (d.toLocaleString(locales[i], {weekday: 'long'}));
		days += " ";
	}
	for (var j=0; j<12; j++){
		d = new Date(2678400000*j);
		days += (d.toLocaleString(locales[i], {month: 'long'}));
		days += " ";
	}
	days += (locales[i]);
	days += '"\n"'
}
console.log(days);
主题已锁定

回到 “Closed topics”

在线用户

正浏览此版面之用户: 没有注册用户 和 1 访客