Skip to content

Feature flag support baseline for localization/i18n

What does this MR do and why?

The goal of this MR is to build the baseline of adding the japanese localization feature on hugo as a placeholder. Currently in this MR it has two specific changes:

  1. Changes that allows japanese pages to be viewable (currently set to disabled as we'll not be releasing them),
  2. Moved the languageCode under the languages section as it becomes redundant at the root once we have the languages
  3. You'd notice that there's no special parameter set, as we can easily use the number of languages at any point of time for conditions.

Related: gitlab-com/localization/docs-site-localization#252 (closed)

Screenshots, screen recordings, or links to review app

This MR doesn't change any functionality except for adding few lines of code as placeholder, so there's no changes before and after. Only if the code is un-commented back again in a local environment, we should be able to view japanese pages.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment.

  2. Check out this branch.

  3. Use make setup and make view to have the docs open locally in your machine,

  4. Visit one of the japanese pages and make sure they are not viewable (returns 404 error) -> http://localhost:1313/ja-jp/ci/yaml/

  5. Once until step 4 is successfully completed, go to the config/_default/hugo.yaml and set under the japanese section at line 148

    disabled: false

    and have it hot reload (if not done automatically)

  6. Re-visit the japanaese page as stated in step 4 -> you should be able to view it.

Important notes:

Hugo cache

  1. Once you're done testing and you'd like to set the disabled: true once again, you may be able to still visit the ja-jp pages -> this seems to how hugo caches all the routes. Even if you switch browsers or set browser cache disabled, the behaviour will persist as this cache is not in the browser itself.
  2. To remove any unwanted caching about routing run the following code in your terminal:
hugo mod clean
rm -rf resources/_gen/
rm -rf public/

Refresh your GitLab repo

While building with disabled: false , if you start encountering errors with few translated files, please make a git fetch for your gitlab repository.

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rasam Hossain

Merge request reports

Loading