Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Translate extension to Wiki #568

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cookbooks/wiki/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@
template_cookbook "wiki"
end

mediawiki_extension "Translate" do
site "wiki.openstreetmap.org"
template "mw-ext-Translate.inc.php.erb"
template_cookbook "wiki"
end

cookbook_file "/srv/wiki.openstreetmap.org/osm_logo_wiki.png" do
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
Expand Down
36 changes: 36 additions & 0 deletions cookbooks/wiki/templates/default/mw-ext-Translate.inc.php.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
# DO NOT EDIT - This file is being maintained by Chef

wfLoadExtension( 'Translate' );
$wgGroupPermissions['user']['translate'] = true;
$wgGroupPermissions['user']['skipcaptcha'] = true; // Bug 34182: needed with ConfirmEdit

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though the bug, I am not sure if it is good to disable the captcha for all logged-in users.
In another perspective, does OSM wiki have ConfirmEdit enabled? (Is this line needed?)
Anyway, I think it would be good if 'autoconfirmed' is used than 'user'.


/**
* Language code for message documentation. Suggested values are qqq or info.
* If set to false (default), message documentation feature is disabled.
*/
$wgTranslateDocumentationLanguageCode = 'qqq';

$wgGroupPermissions['autoconfirmed']['translate-messagereview'] = true;

$wgGroupPermissions['translationadmin']['pagetranslation'] = true;
$wgGroupPermissions['translationadmin']['translate-manage'] = true;

/**
* Add a preference "Do not send me email newsletters" in the email preferences.
*/
$wgTranslateNewsletterPreference = true;

Comment on lines +19 to +23
Copy link

@lens0021 lens0021 May 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Add a preference "Do not send me email newsletters" in the email preferences.
*/
$wgTranslateNewsletterPreference = true;

This configuration variable removed in 2020. (MediaWiki 1.35)

wikimedia/mediawiki-extensions-Translate@1c43244
Bug: T134633

/**
* Let Translate extension use ElasticSearch to store commonly-used translation messages to suggest to translators
*/
$wgTranslateTranslationServices['TTMServer'] = array(
'type' => 'ttmserver',
'class' => 'ElasticSearchTTMServer',
'cutoff' => 0.75,
/*
* See http://elastica.io/getting-started/installation.html
* See https://github.com/ruflin/Elastica/blob/8.x/src/Client.php
*/
'config' => [ 'servers' => [ 'host' => '127.0.0.1', 'port' => 9114 ] ]
);
Comment on lines +27 to +36
Copy link

@lens0021 lens0021 May 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$wgTranslateTranslationServices['TTMServer'] = array(
'type' => 'ttmserver',
'class' => 'ElasticSearchTTMServer',
'cutoff' => 0.75,
/*
* See http://elastica.io/getting-started/installation.html
* See https://github.com/ruflin/Elastica/blob/8.x/src/Client.php
*/
'config' => [ 'servers' => [ 'host' => '127.0.0.1', 'port' => 9114 ] ]
);
$wgTranslateTranslationServices['TTMServer'] = [
'type' => 'ttmserver',
'class' => 'ElasticSearchTTMServer',
'cutoff' => 0.75,
/*
* See http://elastica.io/getting-started/installation.html
* See https://github.com/ruflin/Elastica/blob/8.x/src/Client.php
*/
'config' => [ 'servers' => [ 'host' => '127.0.0.1', 'port' => 9114 ] ]
];

The mix use of old syntax and new syntax has slightly confused me :)