Closed tonyqus closed 2 years ago
Hi @tonyqus ! Thank you for reaching out and for your offer. At the moment we don't have any way to support translations, but I'm chatting with the team about whether this is something we could support. I'll try to get back to you! It would certainly be great to make CoVariants more accessible to more people!
At the moment I'm not sure we have the support available that we could make this happen - unfortunately it would require splitting out all the text areas on the website into separate files & then having these pulled in based on the language. While it would be great to support in theory, I don't think this is something our tiny team (3 people, part time) could support right now.
However, one can always translate the website in Chrome or using Google Translate!
I totally understand that you are a small team and you don't have time to support the localization.
I analyze your code and figure out that you are using next.js, which can support i18n (localization) easily. And I did some experiment and make it work on my local with some urls like localhost:3000/zh-CN/faq to support Chinese.
The current situation in China is a bit complex. The government starts giving up zero-covid policy and a lot of people here still believe Omicron is very dangerous due to the previous news from Chinese media and some fake medical experts. They do need a website like what you did to understand the fact of Omicron. Our official cdc website doesn't provide this kind of information.
The question is do you accept PR so that I can help you make localizaiton for Chinese happen?
The menu is localized in Chinese
The major translation content is located in content folder. I can successfully load zh-CN.md file when the url routing changes to /zh-CN/xxx
Hi @tonyqus,
It's not hard to add the technical implementation. Covariants is currently undergoing a rewrite and I've already added i18next
and react-i18next
to the new version. But it will take a little while before all other issues are resolved there. Might not get ready while it's needed in China.
We wouldn't use Next.js's i18n for that. We currently use SSG (next export
) to make deployment simpler and cheaper, but Next.js i18n requires a server, so that would not work. Neither it is necessary - the same can be done client-side.
But the technical implementation is the easy part. The hard path is who will do the initial translation and then to maintain the translated versions in sync with English version when Emma changes the content. There might be more harm than good in outdated "official" content (which project maintainers are not able to understand or fix)
If you volunteer for the initial translation, then feel free to make a PR.
Regarding your screenshot of the file tree: imagine 10 languages all in one directory - it will be a disaster. It's probably better to separate languages into directories.
I made a first draft in https://github.com/hodcroftlab/covariants/pull/364
Nice to know that. Yeah, I'm willing to provide the translation in Chinese.
Which branch shall I fork to submit this translation? Or Shall I do it after you merge #364?
@tonyqus You can create a branch stemming from the branch feat/i18n
(the branch of the PR https://github.com/hodcroftlab/covariants/pull/364) and then submit a PR from it to feat/i18n
.
The markdown content will go to web/src/content/zh
. It's a large amount of work, so only a portion of files can be provided for gradual translation. If you have a spare moment, you might also review the strings in web/src/i18n/resources/zh/common.json
(the current ones are the automatic translation using AWS Translate).
Hi @tonyqus - just in case it's useful I made a list of all the files that would need to be manually translated in the PR @ivan-aksamentov made above.
You don't have to translate all of them -- any without translations will fallback to English. But it would probably be good to translate the Home page, and for example, perhaps the most recently relevant variants (if you think that's what might be useful).
There's no rush on our end but we'd be happy to try to incorporate anything you can manage.
Hi, I think I've made it work on my box.
I'll start translating the pages.
It looks page heading are hard-coded. Can we make it possile to translate it?
@tonyqus I added this string to translation
If you notice any more hardcoded strings, feel free to surround them by the t()
function like this:
import { useTranslationSafe } from 'src/helpers/useTranslationSafe'
const { t } = useTranslationSafe()
t('Frequently asked questions')
@tonyqus I don't know if the list by @emmahodcroft is of any importance. It links to master branch, which is not how things are organized on feat/i18n
branch anymore, and the order of the list seems alphabetic.
Instead, you can just look at the directory web/src/content/en
on the branch and all necessary English files are gathered there already. All you need is to replicate the same file and directory structure, but with translated content, and put it to web/src/content/${language}
, where ${language}
is zh
in your case, as you correctly show on your screenshot.
You can translate incrementally. First I would focus on the most relevant pages for China. Which does not seem to be how Emma's list is organized. I would consider pages for Omicron and Delta variants, and Home page to be the most important. But I am not expert here, so feel free to chose whichever you think are important.
Once you feel the most relevant info is there, we can release the partial translation so that users can take advantage of it, and the rest of the work can continue incrementally afterwards.
Apologies for not using the locations of the files listed here, I had forgotten that they would be in a different place!
For order, I'd suggest (from highest priority):
However, this is just guidance and I'm happy for you to adjust the order if you think other things are more important or of more interest.
Two missing phrases in big title
missing phrase
Hi @tonyqus, thanks for spotting these ! @ivan-aksamentov is on holiday this week, but hopefully he can fix these couple more phrases when he's back!
I added these 2 strings and a couple more:
d91b49a
(#364)
(and committed that into https://github.com/hodcroftlab/covariants/pull/364)
I also merged master branch into the i18n branch.
@tonyqus Note that there is 1 new variant caried from master branch:
and these 3 files had edits:
I am not sure what's the best and most reliable strategy to compare the edits in the English version and how to keep the translations in-sync. It's a very time-consuming task and requires knowledge of languages.
I'd like to check if you accepts translation contribution of this website. I'm from Shanghai, China. I think the website is really useful for Chinese people since we are still in serious pandamic season.