-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- In the "the main version of the wiki is the english one" info message - In the "this wiki is not yet translated in your locale" info message
- Loading branch information
Showing
10 changed files
with
65 additions
and
33 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
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,25 @@ | ||
import { locale, locales } from "./translations"; | ||
|
||
import { derived } from "svelte/store"; | ||
|
||
import { page } from "$app/stores"; | ||
|
||
// Removes the current locale from the current route | ||
// (only if the current route does contain the locale) | ||
export const current_route = derived([page, locale, locales], ([$page, $locale, $locales], set) => { | ||
const routeExtractor = new RegExp(`^(/${$locale})?(/.+)?$`); | ||
|
||
const routeMatch = $page.url.pathname.match(routeExtractor); | ||
// prettier-ignore | ||
if ( | ||
routeMatch && | ||
( | ||
// We match the locale | ||
routeMatch[1] || | ||
// We don't match the locale and a locale isn't in the route | ||
routeMatch[2] && !$locales.includes(routeMatch[2].replace(/^\/([^/]+)(\/.+)?$/, "$1")) | ||
) | ||
) { | ||
set(routeMatch[2] || ""); | ||
} | ||
}); |
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,9 @@ | ||
<script> | ||
export let href = ""; | ||
export let title = ""; | ||
export let text = ""; | ||
</script> | ||
|
||
<a {href} {title} data-sveltekit-preload-data="false"> | ||
{text} | ||
</a> |
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
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