Check Language Support
Check Language Support
by Lissandro Dittmar
HTML
<div id="banner-message">
<p>Check for translations</p>
<button>Start check</button>
</div>
<div style="background-color: white;">
<ol id="listReady"></ol>
<ol id="list"></ol>
</div>
CSS
i {
color: #669FAB;
}
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#banner-message {
background: #fff;
border-radius: 4px;
padding: 20px;
font-size: 25px;
text-align: center;
transition: all 0.2s;
margin: 0 auto;
width: 300px;
}
button {
background: #0084ff;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
#banner-message.alt {
background: #0084ff;
color: #fff;
margin-top: 40px;
width: 200px;
}
#banner-message.alt button {
background: #fff;
color: #000;
}
JavaScript
var adapterList = [];
const checkForLanguage = "zh-cn";
const start = function(){
for(i=0;i<7;i++){
$.getJSON( "https://api.github.com/search/repositories?q=iobroker&sort=updated&page=" + i + "&per_page=100", function( data ) {
$.each( data.items, function( key, val ) {
const full_name = val.full_name;
const link = "https://raw.githubusercontent.com/" + full_name + "/master/io-package.json";
$.getJSON( link, function(res) {
if($.inArray(full_name, adapterList) == -1 && res && res.common && res.common.desc){
adapterList.push(full_name);
$('#' + ((checkForLanguage in res.common.desc)?"listReady":"list"))
.append( "<li><a href='" + val.html_url + "' target='_blank'>" + res.common.name
+ "</a> - <b style='" + ((checkForLanguage in res.common.desc)?"color:green;":"") + "'>"
+ ((typeof res.common.desc === 'string' || res.common.desc instanceof String)?'en - maybe because there is only one string':Object.keys(res.common.desc)) + "</b></li>" );
}
});
});
});
};
}
$("button").on("click", function(){
start();
});