Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:$wgLanguageCode

From mediawiki.org
Translate this page
Languages:
Language, regional and character encoding settings: $wgLanguageCode
Site language code.
Introduced in version:Before 1.1.0
Removed in version:Still in use
Allowed values:(string)
Default value:'en'
Other settings:Alphabetical |By function

Details

The site language code is usually set automatically with the installer. List of languages codes can be found atincludes/languages/data/Names.php. The code should be in lower case and use hyphen as separator.Examples:en,ku-latn,de-formal,mai

This specifies which language your page content is in, and also provides the default language for your wiki's interface.While users can switch the language of interface messages in theirpreferences, anonymous visitors will see the wiki's interface in the content language.Extension:LanguageSelector provides a way to auto-detect the language of anonymous users and let them choose their interface language without logging in.

If you change this after installation, in MediaWiki 1.18 and above you can clear the message cache by runningecho 'MediaWiki\MediaWikiServices::getInstance()->getMessageCache()->clear()' | php maintenance/run.php eval. Be prepared to update all messages you have customized in your wiki, move your main page and other broken things before and after all caches has been regenerated.
In MediaWiki 1.8 or older, if you change this after installation, you should run themaintenance/rebuildmessages.php script to rebuild the user interface messages (MediaWiki namespace). Otherwise, you will not see the interface in the new language, or a mix of the old and new languages. Note that running that script will override any custom interface messages you may have created.
$wgContLanguageCode gives the same value as$wgLanguageCode, but is deprecated in favor of$wgLanguageCode.(removed in 1.35)


Change existing users' language settings

You can change existing users' language settings with theuserOptions.phpmaintenance script.They will still be able to change their settings back unless you disable that option (see below).

phpuserOptions.phplanguage--olden--newcs

Disable user selection of language

MediaWiki version:
1.16

If you want to have your wiki in a certain language and not allow users to change this setting, there is a new variable in 1.16 and above,$wgHiddenPrefs:

// disable language selection$wgHiddenPrefs[]='language';// if you want to disable variants as well$wgHiddenPrefs[]='variant';$wgHiddenPrefs[]='noconvertlink';$wgLanguageCode='pt-br';

See also

Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:$wgLanguageCode&oldid=6948558"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp