From 5702cd71f75a12a5501353a9be49bffdd589a698 Mon Sep 17 00:00:00 2001 From: Froxcey Date: Thu, 30 Jun 2022 16:30:20 +0800 Subject: [PATCH] Updated guide --- CONTRIBUTING.md | 20 ++++++++++++++++++- TRANSLATING.md | 4 ++++ .../locale/TranslationRebuilder.tsx | 6 ++---- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 18990593..a8a577a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # AvdanOS Website Contributing Guide -For translators, please see [translating guideline](https://github.com/Avdan-OS/Website/blob/dev/TRANSLATING.md) for more information. +If you are a translators, please see [translating guideline](https://github.com/Avdan-OS/Website/blob/dev/TRANSLATING.md) for more information. ## Prerequisite @@ -66,6 +66,24 @@ git push 9. Create pull request on GitHub +## Using translation + +You need to add this code to the beginning of your file + +```js +import { TranslatableText } from "../locale/TranslatableText"; +``` + +Then wrap your text in TranslatableText tag, like this: + +```jsx +I will be translated +``` + +Then just wait for translators to add the translation + +If the text has complicated structure and not just a string, leave it to senior devs and translator. + ## Pull Requests To make the review process faster, it's recommended to have list of changes in comment section and include screenshots if there are changes in the design. List of changes should be concise. diff --git a/TRANSLATING.md b/TRANSLATING.md index 3caf2516..0c1b998f 100644 --- a/TRANSLATING.md +++ b/TRANSLATING.md @@ -14,6 +14,10 @@ Find and open the locale file that you want to contribute to. You might want to In `translation.set`'s parenthesis, there should be two quotes, separated by a comma. The quote at the left is the original text, in all lowercase. The quote at the left side of the command is the translated text. Type your translation in the quotation marks at the right side of the comma. DO NOT EDIT THE LEFT SIDE, IT WILL BREAK THE WEBSITE. If you see a line ended in `// don't translate this yet (technical issue)`, that means this quote is likely to change in the future due to change in how injection works. You can translate it, but it will not appear on the website and might get deleted in the future. If you see something like `[%s]`, `[%/s]`, or anything that's in bracket and contains a percent, maybe a slash, and a letter, it is an indicator for developers to do tricks like adding link or applying bold font. Please do not delete any indicator, and place them where appropriate in the translated string. +## Adding Your Translation + +Find the right section, and add a line of `translation.set("original text","translated text")`. Original text should be exact match of the text, not half a sentence. If half of the link is link or has a different styling, translation will most likely not work. Please just submit a new bug report including a screenshot of where the translated text should be, what the original text is, which page it is on, and tag it with translation. Developers will take care of the rest, and you will just need to wait for a response. IMPORTANT: SEARCH CLOSED ISSUES BEFORE ADDING A NEW ONE. + ## Adding Your Contribution Now all you need to do is create a pull request, name it `Update [your locale] translation`, add optional comment, and tag it with translation. We will review your changes and most likely merge it. diff --git a/src/components/locale/TranslationRebuilder.tsx b/src/components/locale/TranslationRebuilder.tsx index 4c4f9043..ad33c58e 100644 --- a/src/components/locale/TranslationRebuilder.tsx +++ b/src/components/locale/TranslationRebuilder.tsx @@ -1,4 +1,4 @@ -import { Link } from '@geist-ui/core'; +import { Link, useTheme } from '@geist-ui/core'; import NextLink from 'next/link'; const TranslationRebuilder = (key: string, translatedSource: string) => { @@ -15,12 +15,10 @@ const TranslationRebuilder = (key: string, translatedSource: string) => { ); - break; default: - break; + return translatedSource; } }; export default TranslationRebuilder; -//