Skip to content
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

Add minimum setup for the Ukrainian translation #942

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jverce
Copy link
Contributor

@jverce jverce commented Jan 10, 2025

Changelog

  • Add uk entry to the config file
  • Add 404 Not Found page and redirect all /uk/** URLs to it
  • Make the build/serve commands output i18n warnings

Context

  1. Slack thread: https://kubernetes.slack.com/archives/C3HD8ARJ5/p1736261563922009
  2. GH Issue: Support multilingual docs #945

@k8s-ci-robot
Copy link

Hi @jverce. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Andygol
Copy link

Andygol commented Jan 10, 2025

@jverce Thank you a lot to make things going.

Have you thought about extracting language specific settings into separate files, one per language. I hope this will help to make it easier to manage multiple languages simultaneously.

UPD RE https://gohugo.io/getting-started/configuration/#configuration-directory

@Andygol
Copy link

Andygol commented Jan 10, 2025

Yes, localization is a complicated thing. How to present languages in the language selector is also a question that can be a bit confusing 🙃. Here's a good resource that explains in detail why country flags are not identical to the languages people use. I hope you find it useful. https://www.flagsarenotlanguages.com/blog/

{{- $lang := .Lang -}}
{{- if ne $lang "en" -}}

/{{ $lang }}/** /{{ $lang }}/404.html 404
Copy link

Choose a reason for hiding this comment

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

I tried to follow netlify's recommendations locally, but without success
https://docs.netlify.com/routing/redirects/redirect-options/#custom-404-page-handling

Copy link

Choose a reason for hiding this comment

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

And netlify build action failed here also

6:07:05 PM: ========================================================================
6:07:21 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:07:21 PM: uk/404.html
6:07:21 PM:   target does not exist --- uk/404.html --> /uk/docs/latest/
6:07:21 PM:   target does not exist --- uk/404.html --> /uk/docs/latest/install/
6:07:21 PM:   target does not exist --- uk/404.html --> /uk/docs/v3.5/
6:07:21 PM: uk/index.html
6:07:21 PM:   target does not exist --- uk/index.html --> /uk/docs/latest/
6:07:21 PM:   target does not exist --- uk/index.html --> /uk/docs/latest/install/
6:07:21 PM:   target does not exist --- uk/index.html --> /uk/docs/v3.5/
6:07:21 PM: ========================================================================
6:07:21 PM: ✘✘✘ failed in 15.853956324s

Copy link

Choose a reason for hiding this comment

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

It seems that the error is also due to the absence of the files content/uk/_index.html, content/uk/docs/_index.md, and content/uk/docs/v3.5/_index.md. What if you create empty stub files instead of them now?

config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
@Andygol
Copy link

Andygol commented Jan 10, 2025

@jverce Thank you a lot to make things going.

Have you thought about extracting language specific settings into separate files, one per language. I hope this will help to make it easier to manage multiple languages simultaneously.

UPD RE https://gohugo.io/getting-started/configuration/#configuration-directory

@jverce It looks like I managed to split config.yaml into separate parts. This should make it much easier to add new languages and implement CAT-tools in the future. (See config.yaml.diff.zip, PR jverce#1)

It looks like this

➜ tree config 
config
└── _default
    ├── config.yaml
    ├── language.en.yaml
    ├── language.uk.yaml
    └── navigation
        ├── menus.en.yaml
        └── menus.uk.yaml

It would be good if you could integrate these changes into this PR.

UPD main...Andygol:etcd-io-website:config-dir
See PR jverce#1

layouts/index.redirects Outdated Show resolved Hide resolved
@Andygol
Copy link

Andygol commented Jan 15, 2025

@jverce could you please review and merge the PR jverce#1 where the most recent changes are located, comparable to the *.diff file attached here in the discussion, which takes into account many of the nuances of setting up multiple languages. The language.en.yaml and menu.en.yaml files are the basis for adding translations in other languages in the future.

@jverce jverce marked this pull request as ready for review January 15, 2025 16:53
Copy link

@Andygol Andygol left a comment

Choose a reason for hiding this comment

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

Lgtm

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Andygol, jverce
Once this PR has been reviewed and has the lgtm label, please assign jberkus for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

* Add `uk` entry to the languages config (disabled for now)
* Add the Ukrainian translation of the homepage
* Add `404 Not Found` page and redirect all `/uk/*` URLs to it
* Make the build/serve commands output i18n warnings
* Add configuration files for English and Ukrainian languages,
  including site parameters and navigation menus
* Move global repository configuration URLs to config files
* Add `latest_stable_version` parameter to the `config.yaml` file
* Add NPM command to serve with debug logs

Signed-off-by: Jay Vercellone <[email protected]>
Co-authored-by: Andrii Holovin <[email protected]>
@jverce jverce force-pushed the chore/i18n-support branch from b9d26db to 2b74076 Compare January 17, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants