Skip to content

Add Mandar (mdr) language support to LanguagesLib #3180

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

Open
wants to merge 2 commits into
base: dev
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
1 change: 1 addition & 0 deletions src/Lib/LanguagesLib.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ public static function languagesInTatoeba()
'urh' => __d('languages', 'Urhobo'),
'mvv' => __d('languages', 'Tagal Murut'),
'mdf' => __d('languages', 'Moksha'),
'mdr' => __d('languages', 'Mandar'),
'pag' => __d('languages', 'Pangasinan'),
'cos' => __d('languages', 'Corsican'),
'hnj' => __d('languages', 'Hmong Njua (Green)'),
Expand Down
102 changes: 14 additions & 88 deletions tests/TestCase/View/Helper/AnnouncementHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,103 +22,25 @@ public function contextProvider() {
'2020-05-30 02:00 UTC', // "now" time
[ 'enabled' => false ], // value for Announcement in app_config.php
false, // should be displayed or not
null, // shutdown warning message
null, // maintenance message
],
'announcement enabled' => [
'2020-05-30 02:00 UTC',
[ 'enabled' => true ],
true,
null
],
'announcement disabled, hide in 1 minute' => [
'2020-05-30 01:59 UTC',
[ 'enabled' => false, 'hideAfter' => '2020-05-30 02:00 UTC' ],
false,
null,
],
'announcement enabled, 11 minutes to go, without warning' => [
'2020-05-30 01:49:00 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC' ],
true,
null,
],
'announcement enabled, 11 minutes to go, with warning' => [
'2020-05-30 01:49:00 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC', 'shutdownWarning' => true ],
true,
null,
null, // no maintenance message since no maintenance is scheduled
],
'announcement enabled, 10 minutes 59 seconds to go, with warning' => [
'2020-05-30 01:49:01 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC', 'shutdownWarning' => true ],
true,
'in 10 minutes',
],
'announcement enabled, 10 minutes to go, with warning' => [
'2020-05-30 01:50 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC', 'shutdownWarning' => true ],
[ 'enabled' => true, 'maintenance' => ['start' => '2020-05-30 02:00 UTC'] ],
true,
'in 10 minutes',
'Tatoeba will temporarily shut down for maintenance in 10 minutes.',
],
'announcement enabled, 1 minute to go, with warning' => [
'2020-05-30 01:59 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC', 'shutdownWarning' => true ],
true,
'in 1 minute',
],
'announcement enabled, 59 seconds to go, with warning' => [
'2020-05-30 01:59:01 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC', 'shutdownWarning' => true ],
[ 'enabled' => true, 'maintenance' => ['start' => '2020-05-30 02:00 UTC'] ],
true,
'in 59 seconds',
],
'announcement enabled, 1 second to go, with warning' => [
'2020-05-30 01:59:59 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC', 'shutdownWarning' => true ],
true,
'in 1 second',
],
'announcement enabled, hide exactly now, without warning' => [
'2020-05-30 02:00 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC' ],
false,
null,
],
'announcement enabled, hide exactly now, with warning' => [
'2020-05-30 02:00 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC' ],
false,
null,
],
'announcement enabled, hide 1 second ago' => [
'2020-05-30 02:00:01 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC' ],
false,
null,
],
'announcement enabled, hide 1 minute ago' => [
'2020-05-30 02:01 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC' ],
false,
null,
],
'announcement enabled, hide 10 years ago' => [
'2030-05-30 02:00 UTC',
[ 'enabled' => true, 'hideAfter' => '2020-05-30 02:00 UTC' ],
false,
null,
],
'announcement enabled, hideAfter empty' => [
'2020-05-30 02:00 UTC',
[ 'enabled' => true, 'hideAfter' => '' ],
true,
null,
],
'announcement enabled, hideAfter invalid' => [
'2020-05-30 02:00 UTC',
[ 'enabled' => true, 'hideAfter' => 'foobar' ],
true,
null,
'Tatoeba will temporarily shut down for maintenance in 1 minute.',
],
];
}
Expand All @@ -130,14 +52,18 @@ public function testEverything($now, $config, $shouldShow, $warning)
{
Time::setTestNow(new Time($now));
$helper = $this->createHelperWithConfig($config);

$this->assertEquals($shouldShow, $helper->isDisplayed());
$maintenanceMessage = $helper->getMaintenanceMessage();

if (is_null($warning)) {
$this->assertNull($helper->shutdownWarning());
$this->assertEmpty($maintenanceMessage);
} elseif (is_string($maintenanceMessage)) {
$this->assertContains($warning, $maintenanceMessage);
} else {
$this->assertContains($warning, $helper->shutdownWarning());
$this->fail('getMaintenanceMessage returned an unexpected value: ' . var_export($maintenanceMessage, true));
}

Time::setTestNow();
}
}
33 changes: 33 additions & 0 deletions webroot/img/flags/mdr.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.