Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
20 changes: 11 additions & 9 deletions CustomLocalePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @file CustomLocalePlugin.php
*
* Copyright (c) 2016-2022 Language Science Press
* Copyright (c) 2016-2025 Language Science Press
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class CustomLocalePlugin
Expand All @@ -12,7 +12,7 @@
namespace APP\plugins\generic\customLocale;

use APP\core\Application;
use APP\plugins\generic\customLocale\classes\migration\upgrade\v1_2_0\I15_LocaleMigration;
use APP\plugins\generic\customLocale\classes\migration\upgrade\v1_2_0_2\I23_LocaleMigration;
use APP\plugins\generic\customLocale\controllers\grid\CustomLocaleGridHandler;
use APP\template\TemplateManager;
use Exception;
Expand Down Expand Up @@ -56,7 +56,9 @@ public function register($category, $path, $mainContextId = null): bool
*/
public function setupLocalizationOverriding(): void
{
if (is_dir($path = static::getStoragePath())) Locale::registerPath($path, PHP_INT_MAX);
if (is_dir($path = static::getStoragePath())) {
Locale::registerPath($path, PHP_INT_MAX);
}
}

/**
Expand All @@ -80,12 +82,12 @@ public function setupGridHandler(): void
Hook::add('LoadComponentHandler', function (string $hookName, array $args): bool {
$component = $args[0];
if ($component !== 'plugins.generic.customLocale.controllers.grid.CustomLocaleGridHandler') {
return false;
return Hook::CONTINUE;
}

// Allow the custom locale grid handler to get the plugin object
CustomLocaleGridHandler::setPlugin($this);
return true;
return Hook::ABORT;
});
}

Expand All @@ -105,7 +107,7 @@ public function setupDownloadChangesEndpoint(): void
define('HANDLER_CLASS', CustomLocaleHandler::class);
}

return false;
return Hook::CONTINUE;
});
}

Expand All @@ -118,7 +120,7 @@ public function callbackShowWebsiteSettingsTabs(): void
[, $templateMgr, &$output] = $args;
$output .= $templateMgr->fetch($this->getTemplateResource('customLocaleTab.tpl'));
// Permit other plugins to continue interacting with this hook
return false;
return Hook::CONTINUE;
});
}

Expand Down Expand Up @@ -219,7 +221,7 @@ public function getActions($request, $actionArgs): array
public function upgrade(): void
{
try {
(new I15_LocaleMigration())->up();
(new I23_LocaleMigration($this))->up();
} catch (Exception $e) {
error_log("An exception happened while upgrading the customLocale plugin.\n" . $e);
}
Expand All @@ -242,7 +244,7 @@ public function getDescription(): string
}

/**
* @copydoc PKPPlugin::getSeq()
* @copydoc Plugin::getSeq()
*/
public function getSeq(): int
{
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
- Custom Locale Plugin
- Version: (see version.xml)
- Author: Carola Fanselow (updates by Alec Smecher, Erik Hanson)
# Custom Locale Plugin

[![Build Status](https://travis-ci.org/pkp/customLocale.svg?branch=main)](https://travis-ci.org/pkp/customLocale)
[![Build Status](https://github.com/pkp/customLocale/actions/workflows/stable-3_4_0.yml/badge.svg)](https://github.com/pkp/customLocale/actions/workflows/stable-3_4_0.yml)
[![OJS compatibility](https://img.shields.io/badge/ojs-3.4-brightgreen)](https://github.com/pkp/ojs/tree/stable-3_4_0)
[![GitHub release](https://img.shields.io/github/v/release/pkp/customLocale?include_prereleases&label=latest%20release&filter=v1_2*)](https://github.com/pkp/customLocale/releases)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/pkp/customLocale)
[![License type](https://img.shields.io/github/license/pkp/customLocale)](https://github.com/pkp/customLocale/blob/stable-3_4_0/LICENSE)
[![Number of downloads](https://img.shields.io/github/downloads/pkp/customLocale/total)](https://github.com/pkp/customLocale/releases)
[![Commit activity per year](https://img.shields.io/github.qkg1.topmit-activity/y/pkp/customLocale)](https://github.com/pkp/customLocale/graphs/code-frequency)
[![Contributors](https://img.shields.io/github/contributors-anon/pkp/customLocale)](https://github.com/pkp/customLocale/graphs/contributors)

## About

This plugin allows to customize locales via the OJS/OMP/OPS GUI. The default locales
are replaced but not overwritten and can easily be restored. A simple
documentation can be printed that lists all changes made to the locales. The
locales can be customized in the tab 'locale' in management > settings >
website. There is a search function for files and for locale keys within the
locales can be customized in the tab `Locales` in Management > Settings >
Website. There is a search function for files and for locale keys within the
files. The documentation can be printed in the plugin's settings section.

**Original Author: Carola Fanselow**

## License

Copyright (c) 2016-2022 Language Science Press
Copyright (c) 2016-2025 Language Science Press

This plugin is licensed under the GNU General Public License v3.

Expand Down
138 changes: 0 additions & 138 deletions classes/migration/upgrade/v1_2_0/I15_LocaleMigration.php

This file was deleted.

Loading