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

imprv: lang attribute in Html element to correctly reflect locale #8940

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

maeshinshin
Copy link
Contributor

Copy link

changeset-bot bot commented Jul 3, 2024

⚠️ No Changeset found

Latest commit: 130bd54

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@maeshinshin maeshinshin force-pushed the imprv/147666-149169-html-lang-attribute branch from f830259 to 59ade87 Compare July 3, 2024 09:28
apps/app/src/pages/_document.page.tsx Outdated Show resolved Hide resolved
@@ -41,14 +44,24 @@ interface GrowiDocumentProps {
customCss: string | null,
customNoscript: string | null,
pluginResourceEntries: GrowiPluginResourceEntries;
locale: string;
Copy link
Member

Choose a reason for hiding this comment

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

4 行目で imoort している Lang を type として使えそう

Copy link
Contributor Author

Choose a reason for hiding this comment

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

import している type は、GROWI 内部のものであり、rfc 5646 で決められている、lnag attribute の形式に合わないため、以降の行で、map を定義し変換しています。
https://www.ietf.org/rfc/bcp/bcp47.txt

apps/app/src/pages/_document.page.tsx Outdated Show resolved Hide resolved
@maeshinshin maeshinshin force-pushed the imprv/147666-149169-html-lang-attribute branch 2 times, most recently from 678d201 to db41573 Compare July 3, 2024 10:23
@@ -60,13 +73,17 @@ class GrowiDocument extends Document<GrowiDocumentInitialProps> {
const growiPluginService = await import('~/features/growi-plugin/server/services').then(mod => mod.growiPluginService);
const pluginResourceEntries = await growiPluginService.retrieveAllPluginResourceEntries();

const locale = user == null ? langMap[detectLocaleFromBrowserAcceptLanguage(headers)]
: langMap[user.lang ?? configManager.getConfig('crowi', 'app:globalLang') as Lang ?? Lang.en_US];

Copy link
Member

Choose a reason for hiding this comment

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

commons.ts の getNextI18NextConfig 内のコードを共通化し、ここでのマッピング時にも使えるようにしてください。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

共通化し、置き換えました。
common.ts 内のコードも共通化したものを使用するように変更しました。

@maeshinshin maeshinshin force-pushed the imprv/147666-149169-html-lang-attribute branch from db41573 to 01db68d Compare July 5, 2024 07:08
@maeshinshin maeshinshin force-pushed the imprv/147666-149169-html-lang-attribute branch from 01db68d to 130bd54 Compare July 5, 2024 07:26
Copy link

reg-suit bot commented Jul 5, 2024

reg-suit detected visual differences.

Check this report, and review them.

🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴

🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵

What do the circles mean? The number of circles represent the number of changed images.
🔴 : Changed items, ⚪ : New items, ⚫ : Deleted items, and 🔵 Passed items

How can I change the check status? If reviewers approve this PR, the reg context status will be green automatically.

@yuki-takei yuki-takei merged commit a425e10 into master Jul 5, 2024
25 of 27 checks passed
@yuki-takei yuki-takei deleted the imprv/147666-149169-html-lang-attribute branch July 5, 2024 13:06
@github-actions github-actions bot mentioned this pull request Jul 5, 2024
@github-actions github-actions bot mentioned this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants