forked from vercel/swr-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Russian transaltion: - Added russian localization - Added translation for Features from index page (components/features.js) with fallback to English - Small typo fixes found during translation * Added SVGs translation option (#2) - Contributers now can easily translate SVGs by just passing path string - Moved all hard-coded SVGs from pages to components/diagrams/ - If no 'translation' is provided it fallbacks to default locale (en-US)
- Loading branch information
1 parent
4ce21ed
commit b81461a
Showing
53 changed files
with
2,852 additions
and
350 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,20 @@ | ||
import { useRouter } from "next/router"; | ||
|
||
export const draw = (paths = {}, name = "") => { | ||
const { locale, defaultLocale } = useRouter(); | ||
|
||
if (!paths.hasOwnProperty(defaultLocale)) { | ||
throw new Error( | ||
`Please provide '${defaultLocale}' locale inside '${paths}'.` | ||
); | ||
} | ||
|
||
if ( | ||
typeof paths[locale] === "string" && | ||
typeof paths[defaultLocale] === "string" | ||
) { | ||
return paths[locale] || paths[defaultLocale]; | ||
} | ||
|
||
return paths[locale]?.[name] || paths[defaultLocale][name]; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.