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:
- Changes that allows japanese pages to be viewable (currently set to disabled as we'll not be releasing them),
- Moved the
languageCodeunder thelanguagessection as it becomes redundant at the root once we have thelanguages - 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.
-
Configure a local GitLab Docs environment.
-
Check out this branch.
-
Use
make setupandmake viewto have the docs open locally in your machine, -
Visit one of the japanese pages and make sure they are not viewable (returns 404 error) -> http://localhost:1313/ja-jp/ci/yaml/
-
Once until step 4 is successfully completed, go to the
config/_default/hugo.yamland set under the japanese section at line 148disabled: falseand have it hot reload (if not done automatically)
-
Re-visit the japanaese page as stated in step 4 -> you should be able to view it.
Important notes:
Hugo cache
- Once you're done testing and you'd like to set the
disabled: trueonce 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. - 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.
-
I have evaluated the MR acceptance checklist for this merge request.