[16:30:22] From: Frieda Brioschi via WikiIT-l [16:31:10] Oh nevermind, I see the From changed only on that list so it must be something an admin did to help the Yahoo users [18:38:14] hi guys [18:38:34] I am developper on video2commons, how I could know the client wiki language? [18:39:05] I want change the UI to user language [18:39:06] some idea? [18:39:33] I want know the user language, how I could get it from client? [18:39:52] hi [18:40:06] hi MatmaRex welcome [18:41:09] The_Photographer: you can query current user's options using the API: https://commons.wikimedia.org/wiki/Special:ApiSandbox#action=query&format=json&meta=userinfo&uiprop=options (look for "language" in the result) [18:41:34] (i assume you're using oauth or otherwise can access the api as the logged in user) [18:42:07] We are using oauth yes [18:42:23] MatmaRex, I can't request that query on client side, some idea? [18:42:53] not really [18:44:20] MatmaRex, I'm working right know only on client side [18:44:35] maybe making a bridge on my tool space [18:47:25] MatmaRex, anyway thanks [18:51:49] We are using phyton and https://github.com/Toollabs/video2commons/blob/master/www/python/src/app.py [18:52:24] I need the language in the client, I could create a route to know it, maybe [18:59:32] MatmaRex, this var "session" has the language? https://github.com/Toollabs/video2commons/blob/master/www/python/src/app.py#L243 [18:59:53] The_Photographer: no idea. how would i know? [19:00:33] well, it look like some phyton library of oauth [19:04:29] The_Photographer: why can't you make API queries? [19:04:58] tgr, I am not alone in this project. I was working only on client side [19:05:09] however, I am trying comming [19:05:24] by client side you mean JS I suppose? [19:05:41] does that mean the user's browser? [19:05:56] when they visit some Labs machine? [19:06:25] tgr, exactly [19:06:51] you'll have to proxy through the server then [19:07:21] tgr, or maybe it's on session var [19:07:31] it could be already on session var [19:08:02] The_Photographer: are you looking for the Wikipedia user language or something that the user can set independently in your labs application? [19:09:47] tgr, I am looking simply for user languague, I need change my UI to the user preference language [19:12:05] The_Photographer: so where should that user language ultimately come from? you could use browser settings (the Accept-Language header) or your app might have a language selector or you might fetch the Wikipedia user language via OAuth [19:12:35] in the last case, you need to ask whoever does the server side development for your project to do that [19:13:21] tgr, yes, however, they are sleeping, I don't know [19:14:00] tgr, ready!, username is on session var [19:14:48] but language is not and Wikipedia user language is not public information so you won't be helped with that [19:15:35] :( [19:18:17] tgr, I could get it from OAuth? [19:18:39] line 124 here https://github.com/wilfredor/video2commons/edit/master/www/python/src/app.py [19:18:41] maybe? [19:19:32] The_Photographer: edit urls won't work for people who don't have access to that github repo [19:20:14] tgr, sorry https://github.com/wilfredor/video2commons/blob/master/www/python/src/app.py#L125 [19:21:25] The_Photographer: you could stick in something like [19:21:28] auth = OAuth1(consumer_key, consumer_secret, access_token, access_secret) [19:23:00] tgr, It's already using oauth and working [19:23:12] however, I am trying underestand how get the user language from oauth [19:23:32] r = requests.post(url='https://commons.wikimedia.org/w/api.php', data={'action':'query','format':'json','meta':'userinfo','uiprop':'options'}, auth=auth) [19:23:45] data = json.load(r) [19:24:43] let me see [19:24:49] session['language'] = data['query']['userinfo']['options']['language'] [19:26:13] * The_Photographer restarting the server [19:26:23] The_Photographer: see https://www.mediawiki.org/wiki/OAuth/Owner-only_consumers#Python [19:26:34] let me take a look [19:27:03] you are not using an owner-only consumer here but the code will work anyway [19:29:32] its not working [19:29:44] auth=auth come from where? [19:30:13] where I could see python log on wmflabs? [19:31:06] The_Photographer: that depends entirely on how your app was set up [19:32:16] IMO your best bet is to make a stub JS method that always returns English, proceed on, wait until your collaborator who is familiar with Python wakes up, then implement fetching the language [19:32:17] tgr, could you take a look to https://github.com/wilfredor/video2commons/blob/master/www/python/src/app.py#L125 and see how I could implement it? [19:32:35] tgr, I already did that [19:33:02] I just said how you could implement it; I can't help you debug it though, I'm not familiar with flask [19:34:18] tgr, np [19:36:08] tgr, I will try fix it by myself and read the oauth manual. Thanks [19:50:48] The_Photographer: uhh, I tried to set up a test for you and realized we don't have an OAuth grant for private data ( https://phabricator.wikimedia.org/T68493 ) [19:51:02] so this can't be done at the moment, I'm afraid [19:52:25] well language is not private information [19:52:52] it is [19:53:07] :s [19:53:25] more generally, you can't use the userinfo API at all if you don't have private data access rights [19:53:54] poke me in a few weeks when I have more time to fix that bug [19:54:13] till then you have to get user language from some other source, sorry [19:57:41] The_Photographer: tgr: hmm, you can probably cheat this if you really wanted to. at least on commons [19:58:06] The_Photographer: tgr: what if you tried api=parse as the current user, parsing "{{int:lang}}"? commons has this int: hack set up [19:58:14] API action=parse* [19:58:46] (i'm not really familiar with oauth grants, please ignore me if this is crazy talk :) ) [19:59:13] MatmaRex, mmmm [20:01:18] There's probably quite a few places that sort of info is leaked [20:01:35] name of the cache key for parser cache [20:01:54] what language certain error messages in the api are [20:06:14] interesting [20:17:03] MatmaRex: ugh :) [20:17:29] that might work, the API should default to contentlang when used via OAuth but probably doesn't [20:28:00] huh, turns out userinfo does not require viewmyprivateinfo right at all [20:28:15] just skips some fields if the user does not have it [20:46:28] There are a sintaxis problem, however, I can't find the log file [20:46:32] error.log show nothing [21:34:08] [[Tech]]; Yulissa de la cruz; /* EVOLUCIÓN DE LA TELEVISIÓN */ new section; https://meta.wikimedia.org/w/index.php?diff=15637194&oldid=15633209&rcid=7816262 [21:35:28] [[Tech]]; Tegel; Reverted changes by [[Special:Contributions/Yulissa de la cruz|Yulissa de la cruz]] ([[User talk:Yulissa de la cruz|talk]]) to last version by 179.126.15.16; https://meta.wikimedia.org/w/index.php?diff=15637199&oldid=15637194&rcid=7816267