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

Fixed language detection for no regional variant #175

Closed
wants to merge 1 commit into from

Conversation

alcibiadesc
Copy link

This commit refines the approach to extracting language codes from the Accept-Language header.

By employing a unified regex pattern, the code now efficiently captures both simple language codes and those with regional variants.

The language code extraction logic now also splits on both hyphens and underscores, defaulting to the primary language code in cases of regional variants, and always converts the result to lowercase for consistent processing.

This commit refines the approach to extracting language codes from the `Accept-Language` header. 

By employing a unified regex pattern, the code now efficiently captures both simple language codes and those with regional variants. 

The language code extraction logic now also splits on both hyphens and underscores, defaulting to the primary language code in cases of regional variants, and always converts the result to lowercase for consistent processing.
Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for locale-router-advanced canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/locale-router-advanced/deploys/65fc46f2ac638e0008c2e458

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for component-scoped-ssr canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/component-scoped-ssr/deploys/65fc46f20142f000083f43e1

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for multi-page-example ready!

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/multi-page-example/deploys/65fc46f2c3aca500088c6cff
😎 Deploy Preview https://deploy-preview-175--multi-page-example.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for component-scoped-csr canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/component-scoped-csr/deploys/65fc46f29215260008203e9f

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for locale-router-static canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/locale-router-static/deploys/65fc46f28f7f0d00081e343b

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for preprocess-example canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/preprocess-example/deploys/65fc46f2804edc000834d994

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for single-load canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/single-load/deploys/65fc46f255ffff000829674b

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for loaders-example canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/loaders-example/deploys/65fc46f29b6b090008ca9c81

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for locale-param canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/locale-param/deploys/65fc46f2cdb0520009f645bd

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for fallback-locale canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/fallback-locale/deploys/65fc46f262f3eb00080d69ca

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for parser-icu canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/parser-icu/deploys/65fc46f29cd36f0008c52aeb

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for one-page-example canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/one-page-example/deploys/65fc46f29215260008203ea4

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for parser-default canceled.

Name Link
🔨 Latest commit 0ff28b4
🔍 Latest deploy log https://app.netlify.com/sites/parser-default/deploys/65fc46f29215260008203ea9

@alcibiadesc alcibiadesc reopened this Mar 21, 2024
alcibiadesc added a commit to alcibiadesc/lib that referenced this pull request Mar 21, 2024
This commit refines the approach to extracting language codes from the `Accept-Language` header. 

By employing a unified regex pattern, the code now efficiently captures both simple language codes and those with regional variants. 

The language code extraction logic now also splits on both hyphens and underscores, defaulting to the primary language code in cases of regional variants, and always converts the result to lowercase for consistent processing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant