Git Product home page Git Product logo

genshin-dictionary's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

genshin-dictionary's Issues

Check performance from China and improve if it is slow

I hear it is slow to access from China mainland to the foreign websites.

Genshin Dictionary is hosted by Cloudflare and it provides free global CDN, but the China data center is not available unless I bought the most expensive Enterprise plan.
Therefore, the Dictionary is probably served for users in China mainland from the foreign data centers. (Maybe Hong Kong or South Korea?)

Prerequisite

#6

Steps

  • 1. Check performance (pagespeed) on access from China
    • Check Largest Contentful Paint using real-user monitoring (RUM).
  • 2. Consider how can I resolve the performance problem.
    • Option 1. Serve from a server or CDN in China
      • ⚠ Is there any free or cheap static server or CDN?
      • ❌ Can I register ICP Beian?
    • Option 2. set up PWA to cache everything
      • It should be slow on first access, but faster from next access.

i18n ― Simplified Chinese

Support Simplified Chinese UI

Translation library

Genshin Dictionary uses nuxt/i18n for i18n which is based on vue-i18n.

Translation Process

I added PR #48.

In this PR, I added placeholders for zh-CN translations: a910d30
Please add Simplified Chinese translations to the lines I added in the above commit.

After you added the translation, please send me a PR to this i18n-zh-CN branch.

Where to translate

Vue components

Most of the translations are in the .vue files.
.vue files are in:

  • components/
  • layouts/
  • pages/

.vue files have some HTML tags like <template> and <script>.
Translation data is in the <i18n> tags in the JSON format.
See the document to learn more.

nuxt.config.js

nuxt.config.js includes texts for <title> and <meta name="description"> for each pages because you can't add them in the .vue files. (code)

  • siteTitle property is the website title and it is appended after each title. (e.g. '"artifact" is "聖遺物" in Japanese | Genshin Dictionary')
  • {vueFileName}Title property is <title> text before | {siteTitle}.
    • For example, wordIdTitle property is <title> for pages/_wordid.vue. (e.g. /artifact/)
  • {vueFileName}Description property is the text for <meta name="description">.
    • For example, aboutDescription property is <meta name="description"> for pages/about.vue (/about/).

Variables in translation texts

Strings with curly brackets {} in the translation texts are variable.
For example, the following translation includes the createdAt variable in the text.

"updatedOn": "Updated on {createdAt}",

(code)

See the vue-i18n document to learn more.

Debug

To debug, see the Setup section in README:
https://github.com/xicri/genshin-dictionary#setup

You might see the tag texts are empty. This is expected because genshin-dictionary refers to current production tags.json which does not have Simplified Chinese translation yet.

It is not necessary to show tag texts properly, but if you want to show tag texts properly on your local machine:

  1. In your local genshin-langdata directory, switch branch to i18n-zh-CN and run npm run build
  2. Move to your local genshin-dictionary directory, and cp .env.example .env
  3. Set the path to your local genshin-langdata repository to LANGDATA_PATH in .env
  4. Run npm install again. This installs tag data from i18n-zh-CN branch

About site title

You don't have to translate the site title literally.
The Japanese site title is 原神 英語・**語辞典 (Genshin English & Chinese Dictionary), but the English title is just "Genshin Dictionary".

Chinese title might be like "Genshin English Dictionary" or "Genshin English & Japanese Dictionary"? Let me know if you have better options.
A short title is better because there is not so wide space in the header (especially on mobile devices).

In Chinese and Japanese, it might be better to insert whitespace after "原神" because the search engines might misunderstand our site title and cannot recognize the word "原神" if we didn't. (In the Japanese case, Google might misunderstand our website is about "原神英" if the site title was "原神英語・**語辞典")

About tests

The tests on the CI may fail after you add the translation. Just ignore it.

Untranslated texts

Translation for /about/ and /opendata/ are not ready yet.

Reconfigure Cloudflare Pages

Set up automatic deployment to Cloudflare Pages (The main server for Genshin Dictionary & Genshin Machine Translation).

Optimize order of the search results

For example, if you search with "Mondstadt", The word "Mondstadt" appears at the last of the search results currently.
However, "Mondstadt" should be the first result.

List the search results in following order:

  1. exact match with en, ja, and zhCN, and pronunciationJa
  2. exact match with variants.en, variants.ja, and variants.zhCN
  3. forward/backword/partial match with en, ja, and zhCN
  4. forward/backword/partial match with variants.en, variants.ja, and variants.zhCN
  5. forward/backword/partial match with pronunciationJa
  6. exact/forward/backword/partial match with notes (on Japanese UI only) and notesZh (on Chinese UI only)

TypeScriptify & Nextify

Migrate to Next.js / React with TypeScript.

Motivation

Since Nuxt 3 release, it took two months for the first minor release, and until then, Nuxt 3 was still unstable. I guess Nuxt team does not have engineer resources enough. I gave up using Nuxt.

Introduce CDN for mainland China

Cloudflare is slow in mainland China. To provide better performance for users in mainland China, I will add CDN in or around mainland China.

CDN Options

  1. Use CDN located in mainland China
    • 👍 Fastest
    • 😐 Need Chinese language skills
    • 👎 ICP Beian is required (Hard to pass, especially for foreigners like me)
  2. Use Chinese CDN located around mainland China
    • 👎 Not as fast as CDN in mainland China
    • 😐 Need Chinese language skills
    • 👍 ICP Beian is not required
    • Candidate: Qiniu Cloud
  3. Use CDN located in Japan
    • 👎 Slowest
    • 👎 It might cost (but less than 500 JPY per month?)
    • 👍 do not need Chinese language skills
    • 👍 ICP Beian is not required
    • Candidate: Sakura's Web Accelerator

Domain structure

Options:

  1. Use a subdomain dedicated to China
    • e.g. china.genshin-dictionary.com
    • 👍 Free
    • 👎 Poor UX (Users have to switch domains by themselves)
    • 👎 It might affect SEO (duplicate pages)
  2. Use Cloudflare Load Balancing to route traffic from China to CDN for China and traffic from other countries to Cloudflare
    • 👍 It is DNS-based load balancing and less chance to delay on access from China
    • 👍 Better UX (Users do not have to switch domains by themselves)
    • 👎 It may cost (but less than $5 per month?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.