-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feedback-and-services-catalogue-cms-able
- Loading branch information
Showing
6 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
// Add locale to a link if it currently doesn't exist | ||
// Examples, if the locale is 'es': | ||
// https://jobs.nyc.gov/employers -> https://jobs.nyc.gov/es/employers | ||
// https://jobs.nyc.gov/es/employers -> https://jobs.nyc.gov/es/employers | ||
// If locale is 'en': | ||
// https://jobs.nyc.gov/employers -> https://jobs.nyc.gov/employers | ||
if (! function_exists('convert_link_locale')) { | ||
function convert_link_locale($original_url, $site_url, $site_url_localized) { | ||
if (! strpos($original_url, $site_url_localized)) { | ||
$site_url_localized_to_use = $site_url_localized; | ||
if (substr($site_url_localized_to_use, -1) === "/") { | ||
$site_url_localized_to_use = substr_replace($site_url_localized_to_use, "", -1); | ||
} | ||
return str_replace($site_url, $site_url_localized_to_use, $original_url); | ||
} | ||
// if original url is already localized, return it | ||
return $original_url; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters