wikibattle icon indicating copy to clipboard operation
wikibattle copied to clipboard

Making wikibattle multilingual

Open Lichtschalter-5000 opened this issue 5 years ago • 1 comments

As mentioned in #85 it would be cool to play wikibattle in other languages than English.

I'd propose the following solution:

  • Select the desired language from a list of "common" languages (Spanish, German, Russian... Maybe only wikis with more than 100k or 200k or so articles, as listed here)
  • Only match people with the same language (the host of private games can decide which language the game is played in)
  • Take a random English article (from the top 5000)
  • Try switching to the wiki in the desired language as shown here: image
  • As the articles are popular in the English wiki, there's a high chance it'll exist in other languages. If it doesn't, repeat.
  • Same goes for the "goal".
  • Everything else should work just fine, shouldn't it? I haven't yet had a look into how going to the next article works in detail, but I think which wiki (en, de, ru...) we use is easily changeable.

Lichtschalter-5000 avatar Jun 19 '20 11:06 Lichtschalter-5000

oh, that's an interesting approach, thanks for proposing it! This definitely sounds like it could work. Wikipedia has an API to retrieve these inter-language links:

https://en.wikipedia.org/w/api.php?action=help&modules=query%2Blanglinks

It would probably require some refactoring, since IIRC currently the start/goal article selection code is all synchronous, and it'd need to be asynchronous to allow doing these HTTP requests in between. The links for both articles could be retrieved at the same time in a single request by separating the names with a | :

https://en.wikipedia.org/w/api.php?action=query&prop=langlinks&format=json&titles=Germany|France&lllang=de

For the wiki text (everything under the /wiki/ route), we could change the route to be /wiki/:lang/:articlename, or add a query parameter ?lang=ru, and send the request to the right wikipedia site based on that.

goto-bus-stop avatar Jun 19 '20 14:06 goto-bus-stop