d2-docs icon indicating copy to clipboard operation
d2-docs copied to clipboard

[Translation] add translation for docs/tour

Open leverimmy opened this issue 11 months ago • 6 comments

I am ready to contribute to adding a Chinese Simplified translation for the docs/tour. However, I have a few questions regarding the process:

  1. Synchronization with the English Version:
    Since the English version is the main source, how will updates or changes to the English version be communicated to other translations? Is there a process in place to ensure the translated versions stay in sync with any modifications in the main version?

  2. Quality and Formatting Checks:
    Are there any established guidelines or checks (e.g., formatting rules like spaces or newlines between code snippets) to maintain consistency and quality across translations? If so, where can I find these guidelines?

Thank you for your guidance! I look forward to contributing.

leverimmy avatar Feb 09 '25 12:02 leverimmy

Hey @leverimmy that's awesome, would love to see a Chinese version of the docs.

  1. It seems to me in all translated docs in other projects I've come across, there's some discrepancies. I assume most non-native English users go to their native language docs most of the time, but when running into a bug/issue or seeking the newest features, go to the English docs. All that to say: there's no process. When something gets too out of date and someone wants to update it, that's when it'll be updated.

  2. Yes, we have CI in place here. Running ./ci/make.sh fmt enforces these.

Some prior art for Korean docs: https://github.com/terrastruct/d2-docs/pull/202

alixander avatar Feb 10 '25 16:02 alixander

@alixander Thanks for your prompt reply!

  1. Got it, thank you! I’ll try to translate as much content into Chinese (Simplified) as I can in the near future—hopefully this weekend.

  2. Thanks for the information. However, I noticed something in the file docs/tour/hello-world.md: there’s no blank line between the metadata and the imports, as shown below:

    ---
    pagination_next: tour/shapes
    ---
    import CodeBlock from '@theme/CodeBlock';
    import HelloWorld from '@site/static/d2/hello-world.d2';
    

    But in the file i18n/ko/docusaurus-plugin-content-docs/current/tour/hello-world.md, there is a blank line:

    ---
    pagination_next: tour/shapes
    ---
    
    import CodeBlock from '@theme/CodeBlock';
    import HelloWorld from '@site/static/d2/hello-world.d2';
    

    I wonder if this discrepancy is caused by a bug in the CI pipeline.

    Additionally, in Chinese (and Korean, as well as many other languages), it’s common practice to add spaces between Chinese (or Korean) characters and English words. For example, in the file i18n/ko/docusaurus-plugin-content-docs/current/tour/hello-world.md, it would be better to write:

    위 명령문으로 두 셰이프 `x` 와 `y` 를 `hello world` 라는 라벨과 함께 연결할 수 있습니다.
                             ^ Note the space here
    

    rather than:

    위 명령문으로 두 셰이프 `x`와 `y`를 `hello world`라는 라벨과 함께 연결할 수 있습니다.
    

    This kind of spacing improves readability and ensures consistency with linguistic conventions.

By the way, I’ve also reviewed the comments in #202, but I noticed a few mismatches. For instance, in i18n/ko/docusaurus-plugin-content-docs/current/tour/hello-world.md, there’s inline code included directly in the file, whereas in docs/tour/hello-world.md, the code snippet is referenced instead. I hope @Baejw0111 can address this soon.

leverimmy avatar Feb 11 '25 14:02 leverimmy

Additionally, I attempted to use 'zh-cn' as the key in the configuration file (docusaurus.config.js). However, it seems that the keys in the configuration cannot include hyphens:

i18n: {
  defaultLocale: "en",
  locales: ["en", "ko"],
  localeConfigs: {
    en: {
      label: "English",
    },
    ko: {
      label: "Korean (한국어)",
    },
    zh-cn: { // DEFINITELY WRONG
    
    }
  }
}

Would 'zhcn' be an acceptable alternative? Or do you have any other preferences or suggestions for the key naming?

leverimmy avatar Feb 11 '25 14:02 leverimmy

@leverimmy

  1. Discrepancies

Formatting: Blank line or not are both correct. Our formatter for Markdown isn't that strict.

Inline code: The Korean version was contributed before the refactor to use imported code blocks, so there's some that are still using the old way. Going forward, it should use imported code blocks. When in doubt, look at the main english version.

  1. 'zh-cn': in JSON, keys that have hyphens need quotes. So it'd be like this
localeConfigs: {
      en: {
        label: "English",
      },
      ko: {
        label: "Korean (한국어)",
      },
      "zh-CN": {
        label: "Chinese Simplified (简体中文)",
      },
    },

I appreciate your attention to detail. As a Chinese speaker myself, I'll also want to maintain the Chinese docs, maybe even redoing some of the examples in Chinese. Looking forward to it

alixander avatar Feb 11 '25 18:02 alixander

Thank you so much for your detailed response, @alixander! I really appreciate the clarifications and guidance!

leverimmy avatar Feb 12 '25 10:02 leverimmy

@alixander Could you please review #259? This is my first time submitting translation docs to this repo, so I’m worried I might have missed something.

leverimmy avatar Feb 13 '25 03:02 leverimmy