-
-
Notifications
You must be signed in to change notification settings - Fork 328
feat(i18n): localise translations for other git providers #1962
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
Changes from all commits
035ba9f
e2398c4
145cd00
989dd0c
4909690
a51899b
3d8997b
5d19137
edd015e
a7cbfd8
9fdc42a
48a6cf9
c735121
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /** | ||
| * Return the text "see on {git provider}" based on the given provider | ||
| */ | ||
| export function useViewOnGitProvider( | ||
| provider: MaybeRefOrGetter<ProviderId | (string & {}) | null | undefined>, | ||
| ) { | ||
| const { t } = useI18n() | ||
| return computed(() => { | ||
| const uProvider = toValue(provider) | ||
| if (!uProvider) { | ||
| return t('common.view_on.git_repo') | ||
| } | ||
| switch (uProvider) { | ||
| case 'github': | ||
| return t('common.view_on.github') | ||
| case 'gitlab': | ||
| return t('common.view_on.gitlab') | ||
| case 'bitbucket': | ||
| return t('common.view_on.bitbucket') | ||
| case 'gitea': | ||
| return t('common.view_on.gitea') | ||
| case 'forgejo': | ||
| return t('common.view_on.forgejo') | ||
| case 'codeberg': | ||
| return t('common.view_on.codeberg') | ||
| case 'sourcehut': | ||
| return t('common.view_on.sourcehut') | ||
| case 'gitee': | ||
| return t('common.view_on.gitee') | ||
| case 'tangled': | ||
| return t('common.view_on.tangled') | ||
| case 'radicle': | ||
| return t('common.view_on.radicle') | ||
| case 'git': | ||
| return t('common.view_on.git_repo') | ||
| } | ||
|
|
||
| if (import.meta.dev) { | ||
| // oxlint-disable-next-line no-console | ||
| console.warn(`missing '${uProvider}' provider, add it to shared/utils/git-providers.ts!`) | ||
| } | ||
| return t('common.view_on.git_repo') | ||
| }) | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -178,7 +178,6 @@ | |||||
| "skip_link": "Skip to main content", | ||||||
| "warnings": "Warnings:", | ||||||
| "go_back_home": "Go back home", | ||||||
| "view_on_npm": "view on npm", | ||||||
| "per_week": "/ week", | ||||||
| "vanity_downloads_hint": "Vanity number: no packages displayed | Vanity number: for the displayed package | Vanity number: Sum of {count} displayed packages", | ||||||
| "sort": { | ||||||
|
|
@@ -190,7 +189,21 @@ | |||||
| "cancel": "Cancel", | ||||||
| "save": "Save", | ||||||
| "edit": "Edit", | ||||||
| "error": "Error" | ||||||
| "error": "Error", | ||||||
| "view_on": { | ||||||
| "npm": "view on npm", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent capitalisation: "view" should be "View". All other entries in ✏️ Proposed fix- "npm": "view on npm",
+ "npm": "View on npm",📝 Committable suggestion
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's "view" instead of "View" because it was originally like that, the same for github it's "View" because before moving the translation it also was with "View"
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
✏️ Learnings added
🧠 Learnings used |
||||||
| "github": "View on GitHub", | ||||||
| "gitlab": "View on GitLab", | ||||||
| "bitbucket": "View on Bitbucket", | ||||||
| "codeberg": "View on Codeberg", | ||||||
| "git_repo": "View on Git repository", | ||||||
| "forgejo": "View on Forgejo", | ||||||
| "gitea": "View on Gitea", | ||||||
| "gitee": "View on Gitee", | ||||||
| "radicle": "View on Radicle", | ||||||
| "sourcehut": "View on SourceHut", | ||||||
| "tangled": "View on Tangled" | ||||||
| } | ||||||
| }, | ||||||
| "profile": { | ||||||
| "display_name": "Display Name", | ||||||
|
|
@@ -312,7 +325,6 @@ | |||||
| "readme": { | ||||||
| "title": "Readme", | ||||||
| "no_readme": "No README available.", | ||||||
| "view_on_github": "View on GitHub", | ||||||
| "toc_title": "Outline", | ||||||
| "callout": { | ||||||
| "note": "Note", | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have
string & {}, can we usetefromuseI18nto check if the key exists? Otherwise return gihubUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it to use
tebut I do think it's best to return "Git repository" instead of Github as it is closer to the truth than returninggithubby defaultUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the case to the swtich (without default), then add console.warn (add eslint rule to ignore that console.warn) and return the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've figured out that the keys can also be referenced in comments, that way 'te' can still be used