-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Unable to change docs title #713
Comments
Should we just always delete |
What is intended from PR #158 is that user can override Docusaurus provided strings that a project may not like (for example ReasonReact would like to say "Edit" instead of "Edit this Doc" in English). So they can modify Related code: But this introduces this bug because if I made a change to my title, old title from If we always delete That's why there has been no issue with that code before #710 since October 2017 |
Hi @rickyvetter, |
I guess that's true. Hmmm.... gotta think about this a bit. |
Thanks for the analysis @endiliey! Very thorough. You're correct in my intent. The goal was to allow overriding of all Docusaurus provided strings with project-specific defaults. I think those Object.assigns should probably be removed in favor of explicit checking. |
From a chat with @rickyvetter.... The custom lines above that should check if it exists in the file before writing. |
I just checked Docusaurus repo & our documentation website at https://docusaurus.io/docs/en/translation.html
Found out that This means we will delete The user didn't even know that they can even override the string unless they look at Docusaurus code directly. I can assure you that this is the safest choice, it removes this bug, we have lesser code, and it won't break any user website. |
Hi @endiliey While we don't check in the |
@JoelMarcey that's true, but isn't it always a newly generated We always publish through continuous integration (e.g circle CI) in which it uses the github repo as source of truth and there is no So this code is always false in production We never have an existing I might misunderstood it. Let me know if i am. |
same issue here. |
I don't want to put the This should be the next thing fixed before anything else, imho. |
I will look at this some tomorrow. If anyone can look beforehand, that would be great. Even if, short-term, we have to break allowing custom strings to make sure people can modify the header metadata (e.g. title), I think we should consider that. |
I have few alternatives
if (fs.existsSync(CWD + '/i18n/custom-en.json')) {
currentTranslations = JSON.parse(
fs.readFileSync(CWD + '/i18n/custom-en.json', 'utf8')
);
} If this is the case we might need to un- git ignore |
I think I kinda like option #2 after giving it some thought today. What we can do is load the generated What do you think? |
Sounds great @JoelMarcey. Are you going to work on it ? Otherwise, I can submit a PR when I'm back roughly after this week. |
I am going to give it a run - try to get a PR before the weekend. |
@endiliey @JoelMarcey Can I try to fix this bug 😄 |
Hi @vaibhavsingh97 - I have a PR #775 out for this already. If you would like to have a look and provide any additional suggestions, that would be welcome 😄 |
Is this a bug report?
Yes
Have you read the Contributing Guidelines on issues?
Yes
Environment
Platform Agnostic
Latest Docusaurus (master branch)
Steps to Reproduce / Reproducible Demo
docs/getting-started-installation.md
title toInstallation asdf
yarn start
Expected Behavior
Actual Behavior
Investigation
This happen after PR #710
Prior to this,
i18n/en.json
is always newly generatedAfter this,
i18n/en.json
will persist and override newly generatedi18n/en.json
Hence, title is not changing
But PR #710 is correct because it fixes bug from #158 that allow user allow overriding of english strings
Workaround
Delete
i18n/en.json
when changing titleThe text was updated successfully, but these errors were encountered: