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

pkp/pkp-lib#699 Show locale in url in multilingual contexts #9628

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

jyhein
Copy link
Contributor

@jyhein jyhein commented Jan 19, 2024

  • Show the current locale in the url in multilingual contexts.
  • Old links without the locale are redirected to include the current locale.
  • Monolingual contexts do not have the locale

Copy link
Collaborator

@bozana bozana left a comment

Choose a reason for hiding this comment

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

Hi @jyhein, great work! Just a few comments/questions...

classes/core/Core.php Outdated Show resolved Hide resolved
classes/core/Core.php Outdated Show resolved Hide resolved
classes/core/Core.php Outdated Show resolved Hide resolved
classes/core/Core.php Outdated Show resolved Hide resolved
classes/core/PKPPageRouter.php Outdated Show resolved Hide resolved
classes/core/PKPPageRouter.php Outdated Show resolved Hide resolved
classes/core/PKPPageRouter.php Outdated Show resolved Hide resolved
classes/template/PKPTemplateManager.php Outdated Show resolved Hide resolved
classes/template/PKPTemplateManager.php Outdated Show resolved Hide resolved
@bozana bozana merged commit b0c9b5f into pkp:main Apr 25, 2024
1 check passed
$request->redirectUrl($source);
}

$uri = Core::removeBaseUrl($setLocale ? ($_SERVER['HTTP_REFERER'] ?? "") : ($_SERVER['REQUEST_URI'] ?? ""));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @jyhein, in order to support the case that Alec mentioned, I think this line should be something like:

        $uri = $_SERVER['PATH_INFO'];
        if ($setLocale) {
            $uri = Core::removeBaseUrl($_SERVER['HTTP_REFERER'] ?? "");
            if (!empty($request->getBasePath())) {
                $uri = str_replace($request->getBasePath(), '', $uri);
            }
        }

Maybe we should also somehow test if it also works if the journal is using/has configured the following part of the config.inc.php:


; Base URL override settings: Entries like the following examples can
; be used to override the base URLs used by OJS. If you want to use a
; proxy to rewrite URLs to OJS, configure your proxy's URL with this format.
; Syntax: base_url[journal_path] = http://www.example.com
;
; Example1: URLs that aren't part of a particular journal.
;    Example1: base_url[index] = http://www.example.com
; Example2: URLs that map to a subdirectory.
;    Example2: base_url[myJournal] = http://www.example.com/myJournal
; Example3: URLs that map to a subdomain.
;    Example3: base_url[myOtherJournal] = http://myOtherJournal.example.com
 

I think you have such installations, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants