Retrieve first paragraph from Wikipedia in Chinese - mediawiki

I want to retrieve the first paragraph of Wikipedia in Chinese language. I found an API;
http://en.wikipedia.org/w/api.php?action=query&prop=extracts&rawcontinue=1&format=xml&exintro=&titles=samsung
but it returns data in English.
How can I get data from this API in Chinese language?

Wikipedia is not one site but multiple. The article Samsung on English Wikipedia contains no Chinese text, but you are probably looking for the corresponding page on Chinese Wikipedia. As most or all Wikipedias use the TextExtract extension that you are calling above, you can simply change the domain and page title, and use the same API call as you just did:
http://zh.wikipedia.org/w/api.php?action=query&prop=extracts&rawcontinue=1&format=xml&exintro=&titles=%E4%B8%89%E6%98%9F%E9%9B%86%E5%9B%A2
Relevant for Chinese: According to the docs, you should also be able to chose what language variant (e.g. zh-tw, Taiwanese, or zh-cn, mainland) to fetch, using the exvariant parameter.

Related

How to get the name of a Wikidata item within wikicode?

Let's say I have a Wikidata item QID Q19675, and want to get the name of that item in Spanish within the wikicode of an unrelated Mediawiki page.
While getting a property like P281 postal code is easy (just write {{#property:P281|from=Q19675}}), how to get the name, which for some reason is not a normal property?
Unlike this question, this time I am not looking for a REST API, but for a Mediawiki wikicode expression.
You can use the Lua function mw.wikibase.label to get the label in the local language. If you're on a wiki that has a copy of the Wikidata template Label (e.g. the English Wikipedia), you can use that directly: {{label|Q19675}}.
If you want the label in a language other than local, use mw.wikibase.entity:getLabel.

Extract content from Wikipedia to Mediawiki

Is there a way to get the intro content from wikipedia page to my mediawiki page? I was thinking of using wikipedia's api but i dont know how to parse the url on my page and also with templates. I just want a query that will display the introduction part of a wikipedia page on my page?d
I used the External_Data Extension and Wikipedia's api to achieve this.
The API
http://en.wikipedia.org/w/api.php? action=query&prop=extracts&format=json&exintro=&titles=[title of wikipedia page]
How I used it
{{#get_web_data:
url=http://en.wikipedia.org/w/api.php? action=query&prop=extracts&format=json&exintro=&titles={{PAGENAME}}
|format=JSON|data=extract=extract}}
How I displayed the extract on pages
{{#external_value:extract}}
I however need to figure out how to get only a paragraph from the return text. Will probably use a parser function.

How to get English Wikipedia page titles from Arabic page titles

I want to build a dictionary file of Arabic to English wikipedia titles
"wiki_page_title_in_arabic" : "wiki_page_title_in_english"
I now have a list of all the wiki page titles, how can I get the corresponding titles in English ? Putting in mind the huge size of the dictionary.
You could use the API and query for the property language links (prop=langlinks) and fr ease restrict results to English (lllang=en). Example: you have the article Stockholm in Arabic: ستوكهولم
Use the query: http://ar.wikipedia.org/w/api.php?action=query&prop=langlinks&format=json&lllang=en&titles=ستوكهولم
The result will give you the English title.

Google fonts issue

Here is the font that I want to use https://www.google.com/get/noto/#/family/noto-sans
I don't want to download this and use. I want to use it directly from google webfonts.
But when I try to use it from this page https://www.google.com/fonts#UsePlace:use/Collection:Noto+Sans getting issue in utf characters. In fact on first link I can see language between available languages.
This is example of first link on my language:
And here is what I get when I use it from second link (web fonts):
http://cdn.joxi.ru/uploads/prod/2014/08/10/c13/5d9/24da6d7596f2129a32dda1c561e7545b2fdafe9c.jpg
As you see the character ə looks different in results. How to get Noto Sans for specific language from google webfonts?
When you visit https://www.google.com/fonts#UsePlace:use/Collection:Noto+Sans, go to the second step and select the character sets that you want to include for your language.

MediaWiki LocalSettings.php $wgSiteName issue

So I have the wiki exactly as I want it but the sitename variable always reverts to lowercase...
I assume there is a special character maybe..like in c# you have \t or \n to format text but I cannot find anything of the sort..
THis is directly from the wikipage describing sitename
"Site name
The $wgSitename variable holds the name of your wiki setup. This name gets included many times throughout the system, such as via MediaWiki:Pagetitle. For instance, the Wikipedia tagline "'From Wikipedia, the free encyclopedia."' makes use of this setting."
It states that wikipedia uses sitename to title its site as .... 'From Wikipedia, the free encyclopedia.'
They have multiple capital letters
Thanks ahead of time.
That text actually comes from the page MediaWiki:Tagline. Edit that page on your wiki and you can make that line say anything you want. You also have to edit MediaWiki:Common.css like it says in that link to make the tagline show up on pages.