-
Notifications
You must be signed in to change notification settings - Fork 43
Reality in your language
Wouldn't it be cool to have Reality in any language Wikipedia/Wikidata supports?..
Like this:
Reality.language = 'ua'
E('Україна').capital
# => Харків
Reality.language = 'de'
E('Berlin').country
# => Deutschland
Currently, it is one of far targets, but that's not easy. So, the help and contributions would be kindly appreciated.
How it can be done?
Reality currently extracts core data from (English) Wikipedia and Wikidata.
Wikidata is multilingual and uniformly so. Reality currently ignores this fact: there are hard-coded "en" here and there, but I feel like it should be easy to generalize the behavior.
With Wikipedia, things are harder. infoboxer gem, which we develop for structured access to Wikipedia, is targeted to be multi-lingual:
page = Infoboxer.wikipedia(:de).get('Deutschland')
# => #<Page(title: "Deutschland", url: "https://de.wikipedia.org/wiki/Deutschland")....
puts page.paragraphs.first
# (Vollform: Bundesrepublik Deutschland) ist ein föderal verfasster Staat in Mitteleuropa....
But for access to most interesting data there is need for use Wikipedia templates, which are language-version dependent (defined by names). For example,
page.infobox
# => nil
...while visually we can see there's infobox on the page.
That's because there are separate template definitions for each wiki, and only for English wikipedia they are defined.
So, if you want to have Reality in your language, you'll need to start from grasping Wikipedia templates and defining most popular of them.
But outcome could be really great.
- Intro
- Applications
- Links and mentions
- Tutorial:
- Tips & tricks
- Advanced topics
- Molybdenum?..