擴展:LocalisationUpdate

This page is a translated version of the page Extension:LocalisationUpdate and the translation is 53% complete.
MediaWiki扩展手册
LocalisationUpdate
发行状态: 穩定版
实现 数据库
描述 讓本地化訊息盡可能地保持更新
作者 Tom Maaswinkel (12wiki), Niklas Laxström
最新版本 1.4.0 (2016-10-13)
MediaWiki 1.30+
Composer mediawiki/localisation-update
许可协议 GNU通用公眾授權條款2.0或更新版本
下載
Readme
  • $wgLocalisationUpdateRepository
  • $wgLocalisationUpdateDirectory
  • $wgLocalisationUpdateHttpRequestOptions
  • $wgLocalisationUpdateRepositories
季度下載量 127 (Ranked 69th)
正在使用的公开wiki数 989 (Ranked 223rd)
前往translatewiki.net翻譯LocalisationUpdate扩展
問題 开启的任务 · 报告错误

LocalisationUpdate擴展讓你可以隨時更新MediaWiki訊息,而不需要升級MediaWiki軟體。

安裝

  • 下载文件,并将其放置在您extensions/文件夹中的LocalisationUpdate目录内。
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'LocalisationUpdate' );
    $wgLocalisationUpdateDirectory = "$IP/cache";
    
  • 在安裝目錄下建立cache資料夾,並確保伺服器有權限可以寫入。
  •   完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。

配置

$wgLocalisationUpdateDirectory

用來儲存快取檔案的目錄,如果沒有設定則使用預設值$wgCacheDirectory 。 LocalisationUpdate需要一些地方來儲存檔案才能使用;如果$wgLocalisationUpdateDirectory和$wgCacheDirectory都沒有設定,則LocalisationUpdate腳本不會運作。

$wgLocalisationUpdateDirectory默认为false。

$wgLocalisationUpdateRepository

獲取翻譯的預設儲存庫來源。 GitHub被設定為預設儲存庫。 這在版本1.1加入。

$wgLocalisationUpdateRepositories

用來獲取MediaWiki核心及擴展的本地化訊息的儲存庫URL陣列。 預設為Github的MediaWiki Git儲存庫,除非你知道你在做什麼,否則不要更改它。這在版本1.1加入。

使用github的範例

$wgLocalisationUpdateRepositories['github'] = array(
	'mediawiki' =>
		'https://raw.github.com/wikimedia/mediawiki/master/%PATH%',
	'extension' =>
		'https://raw.github.com/wikimedia/mediawiki-extensions-%NAME%/master/%PATH%',
	'skin' =>
		'https://raw.github.com/wikimedia/mediawiki-skins-%NAME%/master/%PATH%'
);

本地檔案系統設定的範例

$wgLocalisationUpdateRepositories['local'] = array(
	'mediawiki' =>
		'file:///resources/projects/mediawiki/master/%PATH%',
	'extension' =>
		'file:///resources/projects/mediawiki-extensions/extensions/%NAME%/%PATH%',
	'skin' =>
		'file:///resources/projects/mediawiki-skins/skins/%NAME%/%PATH%'
);

$wgLocalisationUpdateHttpRequestOptions

MediaWiki版本:
1.35

Options to pass to Http::get(). Possible keys for the array: (see HttpRequestFactory::create()).

timeout
Timeout length in seconds or 'default'
connectTimeout
Timeout for connection, in seconds (curl only) or 'default'
postData
An array of key-value pairs or a url-encoded form data
proxy
The proxy to use. Otherwise it will use $wgHTTPProxy (if set) Otherwise it will use the environment variable "http_proxy" (if set)
noProxy
Don't use any proxy at all. Takes precedence over proxy value(s).
sslVerifyHost
Verify hostname against certificate
sslVerifyCert
Verify SSL certificate
caInfo
Provide CA information
maxRedirects
Maximum number of redirects to follow (defaults to 5)
followRedirects
Whether to follow redirects (defaults to false). Note: this should only be used when the target URL is trusted, to avoid attacks on intranet services accessible by HTTP.
userAgent
A user agent, if you want to override the default MediaWiki/$wgVersion
logger
A \Psr\Logger\LoggerInterface instance for debug logging
username
Username for HTTP Basic Authentication
password
Password for HTTP Basic Authentication
originalRequest
Information about the original request (as a WebRequest object or an associative array with 'ip' and 'userAgent').

Example for using GitHub with HTTP Basic Authentication

$wgLocalisationUpdateHttpRequestOptions = array(
	'followRedirects' => true,
	'username' => 'YOUR_GITHUB_USERNAME',
	'password' => 'YOUR_GITHUB_PERSONAL_ACCESS_TOKEN'
);

用法

當你想要執行更新時,在命令行執行php extensions/LocalisationUpdate/update.php或設定cron任務。

LocalisationUpdate不會自動更新翻譯

如果你使用類unix系統,你應該添加LocalisationUpdate到crontab:

crontab -e
# Add the following line
@daily php /path/to/your/wiki/extensions/LocalisationUpdate/update.php --quiet
如果本地化更新看起來沒有到來,你或許要執行php maintenance/rebuildLocalisationCache.php --force

腳本参数

--repoid: 從此標誌的儲存庫中獲取翻譯

参见