Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\ConfigNames Class Reference

Constants for configuration variables for the Translate extension. More...

Public Attributes

const RecentChangesLanguageFilter = 'TranslateRecentChangesLanguageFilter'
 Add language filter to the Special:RecentChanges.
 
const PageTranslationAllowedContentModels = 'PageTranslationAllowedContentModels'
 Associative array of content model IDs where page translation should be possible.
 
const PageTranslationLanguageList = 'PageTranslationLanguageList'
 How language list for translatable pages is shown.
 
const DocumentationLanguageCode = 'TranslateDocumentationLanguageCode'
 Language code for message documentation.
 
const EnableLuaIntegration = 'TranslateEnableLuaIntegration'
 [Experimental] Enable integration with Lua modules using Scribunto extension.
 
const EnableMessageGroupSubscription = 'TranslateEnableMessageGroupSubscription'
 Enable translators to watch message groups and receive notifications when messages in the group are added, removed or updated.
 
const UserManagerName = 'TranslateUserManagerName'
 Name of the system user that will be used to create the sandbox users in the system.
 
const FuzzyBotName = 'TranslateFuzzyBotName'
 Name of the bot which will invalidate translations and do maintenance for page translation feature.
 
const LanguageFallbacks = 'TranslateLanguageFallbacks'
 Default values for list of languages to show translators as an aid when translating.
 
const SupportUrl = 'TranslateSupportUrl'
 Experimental support since 2011-03-11 for an 'Ask' help button.
 
const SupportUrlNamespace = 'TranslateSupportUrlNamespace'
 Like $wgTranslateSupportUrl, but for a specific namespace.
 
const PageTranslationBannerNamespaces = 'TranslatePageTranslationBannerNamespaces'
 List of namespace numbers for which the call to action banner to mark the page for translation will be displayed to editors who have recently updated the page.
 
const PermissionUrl = 'TranslatePermissionUrl'
 When unprivileged users open a translation editor, they will see a message stating that a special permission is needed for translating messages.
 
const EnablePageTranslation = 'EnablePageTranslation'
 Enable page translation feature.
 
const EnableEventLogging = 'TranslateEnableEventLogging'
 Enable use of analytics on Special:Translate.
 
const PageTranslationULS = 'TranslatePageTranslationULS'
 If set to true, when a user selects an interface language via ULS (Universal Language Selector), if the current page is a translatable page or a translation page then the user is also redirected to the corresponding translation page in the selected language.
 
const KeepOutdatedTranslations = 'TranslateKeepOutdatedTranslations'
 If set to true, when a translated page has some units marked as outdated, the outdated translation will be shown.
 
const DisabledTargetLanguages = 'TranslateDisabledTargetLanguages'
 Two-dimensional array of languages that cannot be translated.
 
const MessagePrefixStatsLimit = 'TranslateMessagePrefixStatsLimit'
 Represents the number of messages that can be queried via Special:MessageGroupStats when fetching message prefixes.
 
const ValidationExclusionFile = 'TranslateValidationExclusionFile'
 File containing validations that are to be skipped.
 
const AuthorExclusionList = 'TranslateAuthorExclusionList'
 Two-dimensional array of rules that exclude certain authors from appearing in the exports.
 
const MessageNamespaces = 'TranslateMessageNamespaces'
 List of namespace that contain messages.
 
const GroupRoot = 'TranslateGroupRoot'
 Location in the filesystem to which paths are relative in custom groups.
 
const GroupFiles = 'TranslateGroupFiles'
 The newest and recommended way of adding custom groups is YAML files.
 
const WorkflowStates = 'TranslateWorkflowStates'
 List of possible message group review workflow states and properties for each state.
 
const GroupAliases = 'TranslateGroupAliases'
 Map from deprecated group IDs to their current ID.
 
const CacheDirectory = 'TranslateCacheDirectory'
 Set location of cache files.
 
const MessageIndex = 'TranslateMessageIndex'
 Configures how the message index is stored.
 
const UseSandbox = 'TranslateUseSandbox'
 Whether to allow users to sign up via a sandbox.
 
const SandboxPromotedGroup = 'TranslateSandboxPromotedGroup'
 To which group the translators are promoted.
 
const SandboxLimit = 'TranslateSandboxLimit'
 Maximum number of translations a user can make in the sandbox.
 
const UsePreSaveTransform = 'TranslateUsePreSaveTransform'
 Pre-save transform for message pages.
 
const RcFilterDefault = 'TranslateRcFilterDefault'
 Default action for the RecentChanges filter, which makes it possible to filter translations away or show them only.
 
const YamlLibrary = 'TranslateYamlLibrary'
 Currently supported YAML drivers are phpyaml or spyc.
 
const TranslationDefaultService = 'TranslateTranslationDefaultService'
 Name of the default translation memory service.
 
const TranslationServices = 'TranslateTranslationServices'
 Define various web services that provide translation suggestions.
 
const StatsProviders = 'TranslateStatsProviders'
 Add, disable or overwrite default stats type providers.
 
const GroupSynchronizationCache = 'TranslateGroupSynchronizationCache'
 If true, enables the group synchronization cache that keeps track of FileBasedMessageGroups messages currently being processed via UpdateMessageJob.
 
const PageMoveLimit = 'TranslatePageMoveLimit'
 If set, displays a warning and does not allow user to move translatable pages having more subpages than this value.
 
const EnableMessageBundleIntegration = 'TranslateEnableMessageBundleIntegration'
 Enable experiment message bundle integration.
 

Detailed Description

Constants for configuration variables for the Translate extension.

Similar to MediaWiki core's MainConfigNames class with similar justifications: avoid typos, easier access to documentation and easier navigation.

The constant values are a public interface via extension.json, but the constant names are internal to the Translate extension.

@license GPL-2.0-or-later

Since
2025.05

Definition at line 21 of file ConfigNames.php.

Member Data Documentation

◆ AuthorExclusionList

const MediaWiki\Extension\Translate\ConfigNames::AuthorExclusionList = 'TranslateAuthorExclusionList'

Two-dimensional array of rules that exclude certain authors from appearing in the exports.

This is useful for keeping bots and people doing maintenance work in translations not to appear besides real translators everywhere.

Rules are arrays, where first element is type: included or excluded. The inclusion list always overrules the exclusion list. Second element should be a valid pattern that can be given a preg_match(). It will be matched against string of format 'group-id;language;author name', without quotes.

As an example, this rule would ignore all authors whose name ends in a bot for all languages and all groups: 'TranslateAuthorExclusionList': [ [ 'black', '/^.*;.*;.*Bot$/Ui' ] ]

Definition at line 177 of file ConfigNames.php.

◆ CacheDirectory

const MediaWiki\Extension\Translate\ConfigNames::CacheDirectory = 'TranslateCacheDirectory'

Set location of cache files.

Defaults to $wgCacheDirectory.

Definition at line 221 of file ConfigNames.php.

◆ DisabledTargetLanguages

const MediaWiki\Extension\Translate\ConfigNames::DisabledTargetLanguages = 'TranslateDisabledTargetLanguages'

Two-dimensional array of languages that cannot be translated.

Input can be exact group name, first part before '-' or '*' for all. Second dimension should be language code mapped to reason for disabling. Reason is parsed as wikitext.

Example: 'TranslateDisabledTargetLanguages': { '*': { 'en': 'English is the source language.' }, 'core': { 'mul': 'Not a real language.' }, 'ext': { 'mul': 'Not a real language.'} }

Definition at line 152 of file ConfigNames.php.

◆ DocumentationLanguageCode

const MediaWiki\Extension\Translate\ConfigNames::DocumentationLanguageCode = 'TranslateDocumentationLanguageCode'

Language code for message documentation.

Suggested values are qqq or info. If set to false (default), message documentation feature is disabled.

Definition at line 46 of file ConfigNames.php.

◆ EnableEventLogging

const MediaWiki\Extension\Translate\ConfigNames::EnableEventLogging = 'TranslateEnableEventLogging'

Enable use of analytics on Special:Translate.

Definition at line 118 of file ConfigNames.php.

◆ EnableLuaIntegration

const MediaWiki\Extension\Translate\ConfigNames::EnableLuaIntegration = 'TranslateEnableLuaIntegration'

[Experimental] Enable integration with Lua modules using Scribunto extension.

Definition at line 51 of file ConfigNames.php.

◆ EnableMessageBundleIntegration

const MediaWiki\Extension\Translate\ConfigNames::EnableMessageBundleIntegration = 'TranslateEnableMessageBundleIntegration'

Enable experiment message bundle integration.

Definition at line 314 of file ConfigNames.php.

◆ EnableMessageGroupSubscription

const MediaWiki\Extension\Translate\ConfigNames::EnableMessageGroupSubscription = 'TranslateEnableMessageGroupSubscription'

Enable translators to watch message groups and receive notifications when messages in the group are added, removed or updated.

Definition at line 57 of file ConfigNames.php.

◆ EnablePageTranslation

const MediaWiki\Extension\Translate\ConfigNames::EnablePageTranslation = 'EnablePageTranslation'

Enable page translation feature.

Page translation feature allows structured translation of wiki pages with simple markup and automatic tracking of changes. See https://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_administration

Definition at line 113 of file ConfigNames.php.

◆ FuzzyBotName

const MediaWiki\Extension\Translate\ConfigNames::FuzzyBotName = 'TranslateFuzzyBotName'

Name of the bot which will invalidate translations and do maintenance for page translation feature.

Also used for importing messages from external sources.

Definition at line 68 of file ConfigNames.php.

◆ GroupAliases

const MediaWiki\Extension\Translate\ConfigNames::GroupAliases = 'TranslateGroupAliases'

Map from deprecated group IDs to their current ID.

Example value: { 'core': 'mediawiki-core' }

Definition at line 216 of file ConfigNames.php.

◆ GroupFiles

const MediaWiki\Extension\Translate\ConfigNames::GroupFiles = 'TranslateGroupFiles'

The newest and recommended way of adding custom groups is YAML files.

Definition at line 193 of file ConfigNames.php.

◆ GroupRoot

const MediaWiki\Extension\Translate\ConfigNames::GroupRoot = 'TranslateGroupRoot'

Location in the filesystem to which paths are relative in custom groups.

Definition at line 188 of file ConfigNames.php.

◆ GroupSynchronizationCache

const MediaWiki\Extension\Translate\ConfigNames::GroupSynchronizationCache = 'TranslateGroupSynchronizationCache'

If true, enables the group synchronization cache that keeps track of FileBasedMessageGroups messages currently being processed via UpdateMessageJob.

Definition at line 303 of file ConfigNames.php.

◆ KeepOutdatedTranslations

const MediaWiki\Extension\Translate\ConfigNames::KeepOutdatedTranslations = 'TranslateKeepOutdatedTranslations'

If set to true, when a translated page has some units marked as outdated, the outdated translation will be shown.

If set to false, the original updated unit in the original language will be shown.

Changing this setting requires the following script to be run to take effect on existing changes: scripts/refresh-translatable-pages.php

Since 2016.12.

Definition at line 141 of file ConfigNames.php.

◆ LanguageFallbacks

const MediaWiki\Extension\Translate\ConfigNames::LanguageFallbacks = 'TranslateLanguageFallbacks'

Default values for list of languages to show translators as an aid when translating.

Each user can override this setting in their preferences.

Example: LanguageFallbacks['fi'] = 'sv' or LanguageFallbacks['sv'] = [ 'da', 'no', 'nn' ].

Definition at line 76 of file ConfigNames.php.

◆ MessageIndex

const MediaWiki\Extension\Translate\ConfigNames::MessageIndex = 'TranslateMessageIndex'

Configures how the message index is stored.

Possible values are 'cdb' and 'database'. The first backend needs $wgCacheDirectory to be functional.

Definition at line 227 of file ConfigNames.php.

◆ MessageNamespaces

const MediaWiki\Extension\Translate\ConfigNames::MessageNamespaces = 'TranslateMessageNamespaces'

List of namespace that contain messages.

No talk namespaces. See https://www.mediawiki.org/wiki/Help:Extension:Translate/Group_configuration

Definition at line 183 of file ConfigNames.php.

◆ MessagePrefixStatsLimit

const MediaWiki\Extension\Translate\ConfigNames::MessagePrefixStatsLimit = 'TranslateMessagePrefixStatsLimit'

Represents the number of messages that can be queried via Special:MessageGroupStats when fetching message prefixes.

Definition at line 158 of file ConfigNames.php.

◆ PageMoveLimit

const MediaWiki\Extension\Translate\ConfigNames::PageMoveLimit = 'TranslatePageMoveLimit'

If set, displays a warning and does not allow user to move translatable pages having more subpages than this value.

Definition at line 309 of file ConfigNames.php.

◆ PageTranslationAllowedContentModels

const MediaWiki\Extension\Translate\ConfigNames::PageTranslationAllowedContentModels = 'PageTranslationAllowedContentModels'

Associative array of content model IDs where page translation should be possible.

Set to true to allow.

Definition at line 30 of file ConfigNames.php.

◆ PageTranslationBannerNamespaces

const MediaWiki\Extension\Translate\ConfigNames::PageTranslationBannerNamespaces = 'TranslatePageTranslationBannerNamespaces'

List of namespace numbers for which the call to action banner to mark the page for translation will be displayed to editors who have recently updated the page.

Since 2024.05

Definition at line 97 of file ConfigNames.php.

◆ PageTranslationLanguageList

const MediaWiki\Extension\Translate\ConfigNames::PageTranslationLanguageList = 'PageTranslationLanguageList'

How language list for translatable pages is shown.

Allowed values:

  • tag-only: Only display languages with the <languages > tag.
  • sidebar-only: Display languages as interlanguage links only and ignore the tag even if present on the page.
  • sidebar-fallback: Display languages as interlanguage links if no tag is on the page.
  • sidebar-always: Display languages as interlanguage links and also in tag if it is present on the page.
    Since
    2018.07

Definition at line 40 of file ConfigNames.php.

◆ PageTranslationULS

const MediaWiki\Extension\Translate\ConfigNames::PageTranslationULS = 'TranslatePageTranslationULS'

If set to true, when a user selects an interface language via ULS (Universal Language Selector), if the current page is a translatable page or a translation page then the user is also redirected to the corresponding translation page in the selected language.

The language of the translation pages visited afterwards will still depend on the links followed (it will be the interface language only if the links use the Special:MyLanguage syntax).

Since 2013-03-10.

Definition at line 130 of file ConfigNames.php.

◆ PermissionUrl

const MediaWiki\Extension\Translate\ConfigNames::PermissionUrl = 'TranslatePermissionUrl'

When unprivileged users open a translation editor, they will see a message stating that a special permission is needed for translating messages.

If this variable is defined, there is a button which will take the user to that page to ask for permission. The target needs to be reiterated with the second variable to have the same result with sandbox enabled where users can't enter the sandbox.

Definition at line 105 of file ConfigNames.php.

◆ RcFilterDefault

const MediaWiki\Extension\Translate\ConfigNames::RcFilterDefault = 'TranslateRcFilterDefault'

Default action for the RecentChanges filter, which makes it possible to filter translations away or show them only.

Possible values: 'noaction', 'only', 'filter', 'site'.

Definition at line 259 of file ConfigNames.php.

◆ RecentChangesLanguageFilter

const MediaWiki\Extension\Translate\ConfigNames::RecentChangesLanguageFilter = 'TranslateRecentChangesLanguageFilter'

Add language filter to the Special:RecentChanges.

Definition at line 25 of file ConfigNames.php.

◆ SandboxLimit

const MediaWiki\Extension\Translate\ConfigNames::SandboxLimit = 'TranslateSandboxLimit'

Maximum number of translations a user can make in the sandbox.

Definition at line 246 of file ConfigNames.php.

◆ SandboxPromotedGroup

const MediaWiki\Extension\Translate\ConfigNames::SandboxPromotedGroup = 'TranslateSandboxPromotedGroup'

To which group the translators are promoted.

If left at false, they will just be removed from sandbox and become normal users.

Definition at line 241 of file ConfigNames.php.

◆ StatsProviders

const MediaWiki\Extension\Translate\ConfigNames::StatsProviders = 'TranslateStatsProviders'

Add, disable or overwrite default stats type providers.

Definition at line 297 of file ConfigNames.php.

◆ SupportUrl

const MediaWiki\Extension\Translate\ConfigNames::SupportUrl = 'TranslateSupportUrl'

Experimental support since 2011-03-11 for an 'Ask' help button.

Might change into a hook later on. This is an array with keys page, url and params: page is a title of a local wiki page; url is an URL to use as is (e.g. an issue tracker submission form) which will override the page if set; params is an array of key-value pairs of request params – each param value can contain the variable MESSAGE% which will be replaced with the full page name.

Definition at line 85 of file ConfigNames.php.

◆ SupportUrlNamespace

const MediaWiki\Extension\Translate\ConfigNames::SupportUrlNamespace = 'TranslateSupportUrlNamespace'

Like $wgTranslateSupportUrl, but for a specific namespace.

Each $wgTranslateSupportUrl-like array needs to be the value assigned to the numerical ID of a namespace of the wiki. Since 2015-09.

Definition at line 91 of file ConfigNames.php.

◆ TranslationDefaultService

const MediaWiki\Extension\Translate\ConfigNames::TranslationDefaultService = 'TranslateTranslationDefaultService'

Name of the default translation memory service.

This service must accept updates.

If left as the default true, the extension will fallback to 'TTMServer'. If $wgTranslateTranslationServices is also unconfigured, built-in values will be used to configure the TtmServer.

If set to false, no translation memory will be used.

Definition at line 279 of file ConfigNames.php.

◆ TranslationServices

const MediaWiki\Extension\Translate\ConfigNames::TranslationServices = 'TranslateTranslationServices'

Define various web services that provide translation suggestions.

Translation memories are documented in our main documentation. See https://www.mediawiki.org/wiki/Help:Extension:Translate/Translation_memories

For Apertium, you should get an API key. See http://wiki.apertium.org/wiki/Apertium_web_service

The machine translation services are provided with the following information: server ip address; versions of MediaWiki and Translate extension; source text to translate; private API key if provided

Definition at line 292 of file ConfigNames.php.

◆ UsePreSaveTransform

const MediaWiki\Extension\Translate\ConfigNames::UsePreSaveTransform = 'TranslateUsePreSaveTransform'

Pre-save transform for message pages.

MediaWiki does this by default (including for pages in the MediaWiki-namespace). By setting this to false it allows users to put untransformed syntax such as '~~~~' into a page without having them be transformed upon save.

Definition at line 253 of file ConfigNames.php.

◆ UserManagerName

const MediaWiki\Extension\Translate\ConfigNames::UserManagerName = 'TranslateUserManagerName'

Name of the system user that will be used to create the sandbox users in the system.

Definition at line 62 of file ConfigNames.php.

◆ UseSandbox

const MediaWiki\Extension\Translate\ConfigNames::UseSandbox = 'TranslateUseSandbox'

Whether to allow users to sign up via a sandbox.

Sandboxed users cannot do much until approved and thus they can be get rid of easily. This only works with MediaWiki 1.27 and newer, and only if registration is configured to not use account creation providers which give REDIRECT or UI responses or require any other field than the default username/password/email.

Definition at line 235 of file ConfigNames.php.

◆ ValidationExclusionFile

const MediaWiki\Extension\Translate\ConfigNames::ValidationExclusionFile = 'TranslateValidationExclusionFile'

File containing validations that are to be skipped.

See https://gerrit.wikimedia.org/g/translatewiki/+/master/groups/validation-exclusion-list.php for example.

Definition at line 164 of file ConfigNames.php.

◆ WorkflowStates

const MediaWiki\Extension\Translate\ConfigNames::WorkflowStates = 'TranslateWorkflowStates'

List of possible message group review workflow states and properties for each state.

The currently supported properties are 'color', the color that is used for displaying the state in the tables, and 'right', the additional right that is needed to set the state. Users who have the translate-groupreview right can set this in Special:Translate. The state is visible in Special:Translate, Special:MessageGroupStats and Special:LanguageStats. If the value is false, the workflow states feature is disabled. State name can be up to 32 characters maximum.

Example: 'TranslateWorkflowStates': { 'new': { 'color': 'FF0000' }, 'needs_proofreading': { 'color': '0000FF' }, 'ready': { 'color': 'FFFF00'}, 'published': { 'color': '00FF00', 'right': 'centralnotice-admin' } }

Definition at line 211 of file ConfigNames.php.

◆ YamlLibrary

const MediaWiki\Extension\Translate\ConfigNames::YamlLibrary = 'TranslateYamlLibrary'

Currently supported YAML drivers are phpyaml or spyc.

For phpyaml see https://secure.php.net/manual/en/book.yaml.php.

phpyaml is the fastest and based on libyaml so the output should be most compatible. spyc output format is least compatible. spyc needs to be installed using composer. See https://www.mediawiki.org/wiki/Composer

Definition at line 269 of file ConfigNames.php.


The documentation for this class was generated from the following file: