Coder Social home page Coder Social logo

Comments (5)

yinsel avatar yinsel commented on May 23, 2024 1

@yinsel are you using docusaurus start or docusaurus build?

The dev server init template hardcodes en as a language:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="generator" content="Docusaurus">
    <title><%= htmlWebpackPlugin.options.title %></title>
    <%= htmlWebpackPlugin.options.headTags %>
    <%= htmlWebpackPlugin.tags.headTags %>
  </head>
  <body>
    <%= htmlWebpackPlugin.options.preBodyTags %>
    <div id="__docusaurus"></div>
    <%= htmlWebpackPlugin.tags.bodyTags %>
    <%= htmlWebpackPlugin.options.postBodyTags %>
  </body>
</html>

This is later updated by the JS code. It has never been a big deal so far. The prod build should not have langauge en.

If this annoys you locally, you'd rather ask Edge to never prompt you to translate content of localhost:3000

Thank you for your reply!

from docusaurus.

OzakIOne avatar OzakIOne commented on May 23, 2024

I've setup a repro and I get <html lang="zh_CN"> or maybe I'm missing something ?

Link

image

Same result when testing locally

image

from docusaurus.

slorber avatar slorber commented on May 23, 2024

Thanks

Can confirm it works on the repro, so @yinsel please show us a runnable repro where we can see this bug in action. Most likely you did a mistake, so until a repro is provided I'm closing this issue.


Note the lang attribute is supposed to be a BCP47 locale:
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang#language_tag_syntax

zh CN or zh_CN are not valid BCP47 codes, only zh or zh-CN is.

from docusaurus.

yinsel avatar yinsel commented on May 23, 2024

I've setup a repro and I get <html lang="zh_CN"> or maybe I'm missing something ?

Link

image

Same result when testing locally

image

You are right, but when using the right mouse button to view the webpage source code, it is<html lang="en">, and after JS processing, it is correct when pressingF12to view the elements. I raised this question because I found that even though the page is in Chinese, Edge still prompts me to translate it into Chinese. Perhaps this is also a small bug or a point that needs optimization?

image

image

from docusaurus.

slorber avatar slorber commented on May 23, 2024

@yinsel are you using docusaurus start or docusaurus build?

The dev server init template hardcodes en as a language:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="generator" content="Docusaurus">
    <title><%= htmlWebpackPlugin.options.title %></title>
    <%= htmlWebpackPlugin.options.headTags %>
    <%= htmlWebpackPlugin.tags.headTags %>
  </head>
  <body>
    <%= htmlWebpackPlugin.options.preBodyTags %>
    <div id="__docusaurus"></div>
    <%= htmlWebpackPlugin.tags.bodyTags %>
    <%= htmlWebpackPlugin.options.postBodyTags %>
  </body>
</html>

This is later updated by the JS code.
It has never been a big deal so far.
The prod build should not have langauge en.

If this annoys you locally, you'd rather ask Edge to never prompt you to translate content of localhost:3000

from docusaurus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.