Added a quick visualization of language localization completion to the Diplomat page.

This commit is contained in:
Nick Winter 2014-08-14 11:43:35 -07:00
parent 5a700c14df
commit 719e64e85f
3 changed files with 99 additions and 56 deletions

View file

@ -1,7 +1,7 @@
FacebookHandler = require 'lib/FacebookHandler'
GPlusHandler = require 'lib/GPlusHandler'
LinkedInHandler = require 'lib/LinkedInHandler'
locale = require 'locale/locale'
locale = require 'locale/locale' # TODO: don't require all of these? Might be slow. (Haven't checked.)
{me} = require 'lib/auth'
Tracker = require 'lib/Tracker'
CocoView = require 'views/kinds/CocoView'

View file

@ -47,66 +47,25 @@ block content
.contributor-signup-anonymous
.contributor-signup(data-contributor-class-id="translator", data-contributor-class-name="diplomat")
h3(data-i18n="contribute.translating_diplomats")
| Our Translating Diplomats:
//#contributor-list
// TODO: collect CodeCombat userids for these guys so we can include a tiled list
ul.diplomats
//li Arabic -
//li Bahasa Malaysia -
//li Bulgarian -
//li Catalan -
li Chinese - Chinese - Adam23, spacepope, yangxuan8282, Cheng Zheng
//li Chinese (Simplified) -
//li Chinese (Traditional) -
li Czech - vanous
li Danish - Einar Rasmussen, sorsjen, Randi Hillerøe, Anon
li Dutch - Glen De Cauwsemaecker, Guido Zuidhof, Ruben Vereecken, Jasper D'haene
//li Dutch (Belgium) -
//li Dutch (Netherlands) -
//li English -
//li English (AU) -
//li English (UK) -
//li English (US) -
//li Finnish -
li French - Xeonarno, Elfisen, Armaldio, MartinDelille, pstweb, veritable, jaybi, xavismeh, Anon, Feugy
li German - Dirk, faabsen, HiroP0, Anon, bkimminich
//li German (Austria) -
//li German (Germany) -
//li German (Switzerland) -
li Greek - Stergios
//li Hebrew -
//li Hindi -
li Hungarian - ferpeter, csuvsaregal, atlantisguru, Anon
//li Indonesian -
li Italian - flauta
li Japanese - g1itch, kengos, treby
//li Korean -
//li Lithuanian -
li Norwegian - bardeh
//li Norwegian (Bokmål) -
//li Norwegian Nynorsk -
li Persian - Reza Habibi (Rehb)
li Polish - Anon, Kacper Ciepielewski
//li Portuguese -
li Portuguese (Brasil) - Gutenberg Barros, Kieizroe, Matthew Burt, brunoporto, cassiocardoso
li Portuguese (Portugal) - Matthew Burt, ReiDuKuduro, Imperadeiro98
//li Romanian -
li Russian - fess89, ser-storchak, Mr A, a1ip
//li Serbian -
li Slovak - Anon
//li Slovene -
//li Spanish -
li Spanish (Latin America) - Jesús Ruppel, Matthew Burt, Mariano Luzza
li Spanish (Spain) - Matthew Burt, DanielRodriguezRivero, Anon, Pouyio
//li Swedish -
li Thai - Kamolchanok Jittrepit
li Turkish - Nazım Gediz Aydındoğmuş, cobaimelan, wakeup
li Ukrainian - fess89
//li Urdu -
li Vietnamese - Vietnamese - An Nguyen Hoang Thien
//li Wuu (Simplified) -
//li Wuu (Traditional) -
each stats, languageCode in languageStats
if !(languageCode.indexOf('-') != -1 && stats.completion < 0.02 && !stats.diplomats.length)
li
a(href=stats.githubURL)
span= stats.englishDescription
if stats.englishDescription != stats.nativeDescription
span.spl.spr -
span= stats.nativeDescription
if stats.diplomats.length
span.spl - #{stats.diplomats.join(', ')}
.progress
.progress-bar(style='width: ' + (100 * stats.completion) + '%')
span(style=stats.completion < 0.06 ? 'color: black; text-shadow: 0px 1px 0px white' : '')= (100 * stats.completion).toFixed(1) + '%'
div.clearfix

View file

@ -6,3 +6,87 @@ module.exports = class DiplomatView extends ContributeClassView
id: 'diplomat-view'
template: template
contributorClassName: 'diplomat'
getRenderData: ->
context = super()
context.viewName = @viewName
context.user = @user unless @user?.isAnonymous()
context.languageStats = @calculateSpokenLanguageStats()
context
calculateSpokenLanguageStats: ->
@locale ?= require 'locale/locale'
totalStrings = @countStrings @locale.en
languageStats = {}
for languageCode, language of @locale
languageStats[languageCode] =
githubURL: "https://github.com/codecombat/codecombat/blob/master/app/locale/#{languageCode}.coffee"
completion: @countStrings(language) / totalStrings
nativeDescription: language.nativeDescription
englishDescription: language.englishDescription
diplomats: @diplomats[languageCode]
languageCode: languageCode
languageStats
countStrings: (language) ->
translated = 0
for section, strings of language.translation
translated += _.size strings
translated
diplomats:
en: [] # English - English
'en-US': [] # English (US), English (US)
'en-GB': [] # English (UK), English (UK)
'en-AU': [] # English (AU), English (AU)
ru: ['fess89', 'ser-storchak', 'Mr A', 'a1ip'] # русский язык, Russian
de: ['Dirk', 'faabsen', 'HiroP0', 'Anon', 'bkimminich'] # Deutsch, German
'de-DE': [] # Deutsch (Deutschland), German (Germany)
'de-AT': [] # Deutsch (Österreich), German (Austria)
'de-CH': [] # Deutsch (Schweiz), German (Switzerland)
es: [] # español, Spanish
'es-419': ['Jesús Ruppel', 'Matthew Burt', 'Mariano Luzza'] # español (América Latina), Spanish (Latin America)
'es-ES': ['Matthew Burt', 'DanielRodriguezRivero', 'Anon', 'Pouyio'] # español (ES), Spanish (Spain)
zh: ['Adam23', 'spacepope', 'yangxuan8282', 'Cheng Zheng'] # , Chinese
'zh-HANS': [] # , Chinese (Simplified)
'zh-HANT': [] # , Chinese (Traditional)
'zh-WUU-HANS': [] # , Wuu (Simplified)
'zh-WUU-HANT': [] # , Wuu (Traditional)
fr: ['Xeonarno', 'Elfisen', 'Armaldio', 'MartinDelille', 'pstweb', 'veritable', 'jaybi', 'xavismeh', 'Anon', 'Feugy'] # français, French
ja: ['g1itch', 'kengos', 'treby'] # , Japanese
ar: [] # العربية, Arabic
pt: [] # português, Portuguese
'pt-BR': ['Gutenberg Barros', 'Kieizroe', 'Matthew Burt', 'brunoporto', 'cassiocardoso'] # português do Brasil, Portuguese (Brazil)
'pt-PT': ['Matthew Burt', 'ReiDuKuduro', 'Imperadeiro98'] # Português (Portugal), Portuguese (Portugal)
pl: ['Anon', 'Kacper Ciepielewski'] # język polski, Polish
it: ['flauta'] # italiano, Italian
tr: ['Nazım Gediz Aydındoğmuş', 'cobaimelan', 'wakeup'] # Türkçe, Turkish
nl: ['Glen De Cauwsemaecker', 'Guido Zuidhof', 'Ruben Vereecken', 'Jasper D\'haene'] # Nederlands, Dutch
'nl-BE': [] # Nederlands (België), Dutch (Belgium)
'nl-NL': [] # Nederlands (Nederland), Dutch (Netherlands)
fa: ['Reza Habibi (Rehb)'] # فارسی, Persian
cs: ['vanous'] # čeština, Czech
sv: [] # Svenska, Swedish
id: [] # Bahasa Indonesia, Indonesian
el: ['Stergios'] # ελληνικά, Greek
ro: [] # limba română, Romanian
vi: ['An Nguyen Hoang Thien'] # Tiếng Việt, Vietnamese
hu: ['ferpeter', 'csuvsaregal', 'atlantisguru', 'Anon'] # magyar, Hungarian
th: ['Kamolchanok Jittrepit'] # , Thai
da: ['Einar Rasmussen', 'sorsjen', 'Randi Hillerøe', 'Anon'] # dansk, Danish
ko: [] # , Korean
sk: ['Anon'] # slovenčina, Slovak
sl: [] # slovenščina, Slovene
fi: [] # suomi, Finnish
bg: [] # български език, Bulgarian
no: ['bardeh'] # Norsk, Norwegian
nn: [] # Norwegian (Nynorsk), Norwegian Nynorsk
nb: [] # Norsk Bokmål, Norwegian (Bokmål)
he: [] # עברית, Hebrew
lt: [] # lietuvių kalba, Lithuanian
sr: [] # српски, Serbian
uk: ['fess89'] # українська мова, Ukrainian
hi: [] # ि, Hindi
ur: [] # اُردُو, Urdu
ms: [] # Bahasa Melayu, Bahasa Malaysia
ca: [] # Català, Catalan