Skip to content

ko-translate #20

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

Merged
Merged

Conversation

CDDing
Copy link
Contributor

@CDDing CDDing commented May 1, 2025

ko-translate

Copy link
Member

@karnkaul karnkaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the intense work involved in translating all the pages!

There are some more minor changes needed, I've created a temporary branch to demonstrate what they are: https://github.com/cpp-gamedev/learn-vulkan/compare/CDDing:feature/translations..karnage/ko-fixes. Update "KR" to the actual text you want in the language dropdown.

I'd request you to add yourself as an author for KO as well (similar to ZH).

Please preview the website and make sure it appears and works as you expect: to do this, run

cd guide
cmake -P build.cmake

And then open guide/book/index.html in a browser.

Screenshot_20250501_081101

@CDDing
Copy link
Contributor Author

CDDing commented May 1, 2025

I just fixed by you recommendded, but
2025-05-02 02:05:48 [INFO] (mdbook::book): Book building has started
2025-05-02 02:05:48 [INFO] (mdbook::book): Running the html backend
2025-05-02 02:05:48 [ERROR] (mdbook::utils): Error: Rendering failed
2025-05-02 02:05:48 [ERROR] (mdbook::utils): Caused By: Error rendering "index" line 23, col 32: Helper not defined: "resource"
CMake Error at build.cmake:16 (execute_process):
execute_process failed command indexes:

this error occured when i try to build it.
what can I do?

I also pushed it.

@karnkaul
Copy link
Member

karnkaul commented May 1, 2025

I just fixed by you recommendded, but 2025-05-02 02:05:48 [INFO] (mdbook::book): Book building has started 2025-05-02 02:05:48 [INFO] (mdbook::book): Running the html backend 2025-05-02 02:05:48 [ERROR] (mdbook::utils): Error: Rendering failed 2025-05-02 02:05:48 [ERROR] (mdbook::utils): Caused By: Error rendering "index" line 23, col 32: Helper not defined: "resource" CMake Error at build.cmake:16 (execute_process): execute_process failed command indexes:

this error occured when i try to build it. what can I do?

I also pushed it.

Weird, I just approved CI and it built the website fine there: https://github.com/cpp-gamedev/learn-vulkan/actions/runs/14779911533/job/41502215999?pr=20

Copy link
Member

@karnkaul karnkaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that the site builds locally

@karnkaul karnkaul merged commit 2bdf8cf into cpp-gamedev:feature/translations May 2, 2025
8 checks passed
karnkaul added a commit that referenced this pull request May 2, 2025
* Preliminary multilingual support (#10)

* Preliminary multilingual support

mdBook does not natively support multilingual documentation. A common
approach is to use a third-party library like mdbook-i18n-helper, which
relies on a Gettext-based workflow to enable multilingual support.

However, I believe such a complex system is unnecessary for our case.
Therefore, this commit follows the approach suggested in the official
mdBook documentation: overriding the 'index.hbs' template to add a
button that redirects users to the corresponding documentation in
another language, thus achieving basic multilingual support.

This commit introduces the following three files under the theme
directory:

- 'index.hbs': Adds a redirect button for switching languages.
- 'lang-toggle.css': Defines the styling for the button and the dropdown
  menu.
- 'lang-toggle.js': Implements the main logic behind the button's
  behavior.

As a result, two separate books need to be built. However, since
mdBook’s 'book.toml' does not support multiple '[book]'' sections in a
single configuration.

This commit introduces a CMake script to build different language
versions of the book and place them in their respective directories.
It can be tested by command 'cmake -P build.cmake'.

Due to mdBook's behavior, the 'src' field in 'book.toml' determines the
root URL. Therefore, if the theme directory is placed above the src
directory, mdBook will copy it relative to the 'src' path during the
build, which will cause the theme folder to become unreachable.

Since English is the primary language of this documentation, the default
behavior supports running 'mdbook' command directly from the guide
directory, such as with 'mdbook serve'. However, this will only generate
the English version of the documentation, other languages will not be
built. To build other language versions using the mdbook command
directly, it must manually adjust their respective book.toml files.

All translations are placed under 'guide/translations'. To add a new
language, it need to follow the same folder structure, update the CMake
script, and register the new language in 'theme/index.hbs'.

[1]: https://github.com/google/mdbook-i18n-helpers

* Stick to 'snake_case' for filenames

* Stick to 'snake_case' for file reference

* Add CI workflow to build guide books (#13)

* Add build book job to CI

* Test book build breakage

* `execute_process()`: treat errors as fatal

* Revert deliberate breakage

* Replace Karn Kaul with Karnage (#14)

* ko-translate (#20)

* ko-translate getting_started

* ko-translate initialization.md

* ko-translate rendering

* ko-translate ImGui

* ko-translate shader_objects

* ko-translate memory

* ko-translate descriptorSets

* revise and summary

* fix

---------

Co-authored-by: Karn Kaul <karnkaul@gmail.com>

* Remove zh-TW

---------

Co-authored-by: Mes <mes900903@gmail.com>
Co-authored-by: MyungKun Chang <58208787+CDDing@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants