Jump to content

Extension:LocalisationUpdate: Difference between revisions

From mediawiki.org
Content deleted Content added
Removed page from translation
Replaced content with "{{Archived extension|6317009|task=T309694}}"
Tag: Replaced
Line 1: Line 1:
{{Archived extension|6317009|task=T309694}}
{{Removed|1=1.38|2=This extension has been abandoned and thus no longer bundled in MediaWiki 1.38. See [[phab:T300498|task T300498]] for more information.}}
{{archival requested|T309694}}
{{Extension|templatemode =
|status = stable
|type = database
|username =
|author = Tom Maaswinkel (12wiki), [[User:Nikerabbit|Niklas Laxström]]
|description = Allows to keep the localized messages as up to date as possible
|image =
|imagesize =
|compatibility policy =
|version = 1.4.0
|update = 2016-10-13
|mediawiki = 1.30+
|license = GPL-2.0+
|download = {{WikimediaDownload|LocalisationUpdate|phab=ELOC}}
|readme = {{git file|project=mediawiki/extensions/LocalisationUpdate|branch=HEAD|file=README|text=Readme}}
|changelog =
|tags =
|example =
|compatibility =
|phabricator = MediaWiki-extensions-LocalisationUpdate
}}
The '''LocalisationUpdate''' extension allows to update the localizations for MediaWiki messages at any time, without needing to upgrade the MediaWiki software.

==Installation==
{{ExtensionInstall
|repo-name=LocalisationUpdate
|localsettings=$wgLocalisationUpdateDirectory = "$IP/cache";
|custom-steps=* Create a <code>cache</code> folder in the installation directory, and be sure the server has permissions to write on it.
|registration=required
}}

==Configuration==

=== $wgLocalisationUpdateDirectory ===
Directory to store cache files in, if not set then it uses default {{ll|Manual:$wgCacheDirectory|$wgCacheDirectory}}.
LocalisationUpdate requires some place to store files in to work; if neither $wgLocalisationUpdateDirectory nor $wgCacheDirectory is set, LocalisationUpdate's update.php script will not work.

$wgLocalisationUpdateDirectory is set to false by default.

=== $wgLocalisationUpdateRepository ===
Default repository source to fetch translation.
GitHub is set to default repository.
This is added with version 1.1.

=== $wgLocalisationUpdateRepositories ===
Array of repositories URLs from which to retrieve localisations for core MediaWiki and extensions.
Default is set to GitHub's MediaWiki [[Git]] repositories and you should not change this unless you know what you're doing. This is added with version 1.1.

Example for using github

<syntaxhighlight lang="php">
$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%'
);
</syntaxhighlight>

Example for local filesystem configuration

<syntaxhighlight lang="php">
$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%'
);
</syntaxhighlight>

=== $wgLocalisationUpdateHttpRequestOptions ===
{{MW 1.35|and after}}
Options to pass to <code>{{method doclink | class=Http | anchor=a40f9552f29cfb2116b05d2c8af14841e | method=Http::get() }}</code>.
Possible keys for the array: (see <code>{{method doclink | class=MediaWiki\Http\HttpRequestFactory | anchor=aa1700986e8b3a2597ce1cddb1aff870e | method=HttpRequestFactory::create() }}</code>).

; 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

<syntaxhighlight lang="php">
$wgLocalisationUpdateHttpRequestOptions = array(
'followRedirects' => true,
'username' => 'YOUR_GITHUB_USERNAME',
'password' => 'YOUR_GITHUB_PERSONAL_ACCESS_TOKEN'
);
</syntaxhighlight>

== Usage ==

Whenever you want to run an update, run <code>php extensions/LocalisationUpdate/update.php</code> on the command line, or set up a cron job.

{{Note|1=LocalisationUpdate does not update translations automatically}}

If you are on a unix-like system, you should add LocalisationUpdate to crontab:

crontab -e
# Add the following line
@daily php /path/to/your/wiki/extensions/LocalisationUpdate/update.php --quiet

{{Note|1=If localization updates don't seem to come through, you may need to run <code>php maintenance/rebuildLocalisationCache.php --force</code>.}}

=== Script parameters ===
:<code>--repoid</code>: Fetch translations from repositories identified by this

== See also ==
*{{ll|Localisation}}
*[[wikitech:LocalisationUpdate|Technical details]] about how this runs on Wikimedia projects.

{{Used by}}

[[Category:Localisation extensions{{#translation:}}]]

Revision as of 10:30, 18 January 2024