-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add "Languages" navigation and article #6382
Merged
+166
−18
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d3a7a76
Add new article "Translations"
smikitky 6c5f913
Add "languages" button in TopNav
smikitky c99c6a1
Add link to English (main) site
smikitky 4853f7b
Split deployedTranslations into multiple lines
smikitky 6df5ceb
Merge branch 'main' into translations
smikitky e4945c1
Merge remote-tracking branch 'upstream/main' into translations
smikitky 3d62c0f
Merge branch 'main' into translations
smikitky 6c69b70
Fix build error regarding types
smikitky fe9ac84
Merge 'upstream/main' into translations
smikitky 8500426
Address some review comments
smikitky 139bedf
Update src/content/community/translations.md
smikitky 437776b
Update src/content/community/translations.md
rickhanlonii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,14 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
*/ | ||
|
||
import {createContext} from 'react'; | ||
|
||
export type LanguageItem = { | ||
code: string; | ||
name: string; | ||
enName: string; | ||
}; | ||
export type Languages = Array<LanguageItem>; | ||
|
||
export const LanguagesContext = createContext<Languages | null>(null); | ||
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ import * as React from 'react'; | |
import Head from 'next/head'; | ||
import {withRouter, Router} from 'next/router'; | ||
import {siteConfig} from '../siteConfig'; | ||
import {deployedTranslations} from 'utils/deployedTranslations'; | ||
|
||
export interface SeoProps { | ||
title: string; | ||
|
@@ -17,16 +18,8 @@ export interface SeoProps { | |
searchOrder?: number; | ||
} | ||
|
||
const deployedTranslations = [ | ||
'en', | ||
'zh-hans', | ||
'es', | ||
'fr', | ||
'ja', | ||
// We'll add more languages when they have enough content. | ||
// Please DO NOT edit this list without a discussion in the reactjs/react.dev repo. | ||
// It must be the same between all translations. | ||
]; | ||
// If you are a maintainer of a language fork, | ||
// deployedTranslations has been moved to src/utils/deployedTranslations.ts. | ||
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. This had to be extracted to a new module because it is now used by other components as well as cache key calculation. |
||
|
||
function getDomain(languageCode: string): string { | ||
const subdomain = languageCode === 'en' ? '' : languageCode + '.'; | ||
|
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 @@ | ||
--- | ||
title: Translations | ||
--- | ||
|
||
<Intro> | ||
|
||
React docs are translated by the global community into many languages all over the world. | ||
|
||
</Intro> | ||
|
||
## Translated languages {/*translated-languages*/} | ||
smikitky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{/* If you are a language maintainer and want to add your language here, finish the "Core" translations and edit `deployedTranslations` under `src/utils`. */} | ||
|
||
<LanguageList showTranslated={true} /> | ||
smikitky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Languages undergoing translation work {/*languages-undergoing-translation-work*/} | ||
smikitky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The list below includes languages with a significant amount of completed translation as well as those with little to no progress. The translation progress for each language is being tracked in [Is React Translated Yet?](https://translations.react.dev/) | ||
smikitky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<LanguageList showTranslated={false} /> | ||
|
||
## How to contribute {/*how-to-contribute*/} | ||
rickhanlonii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
You can contribute to the translation efforts! The community conducts the translation work for the React docs on each language-specific fork of react.dev. Typical translation work involves directly translating a Markdown file and creating a pull request. Visit the GitHub repository for your language, and follow the instructions there or contact one of the maintainers. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This is a list of languages with enough translated content. | ||
// Add more languages here when they have enough content. | ||
// Please DO NOT edit this list without a discussion in the reactjs/react.dev repo. | ||
// It must be the same between all translations. | ||
// This will also affect the 'Translations' article. | ||
|
||
export const deployedTranslations = ['en', 'zh-hans', 'es', 'fr', 'ja']; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This follows the same pattern as TocContext.ts.