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

JavaScript error: Uncaught RangeError: Incorrect locale information provided #25324

Open
hiifong opened this issue Jun 17, 2023 · 8 comments
Open
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@hiifong
Copy link
Contributor

hiifong commented Jun 17, 2023

Description

When the language of gitea is Chinese, using the Google Translate page and then using the detected language will cause problems。

image

1687008886516.mp4

Gitea Version

v1.20+

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

./gitea web

Database

None

@silverwind
Copy link
Member

Video does not work for me. Is this cause by Google Translate modifying the page? Is it a browser addon?

@hiifong
Copy link
Contributor Author

hiifong commented Jun 18, 2023

Video does not work for me. Is this cause by Google Translate modifying the page? Is it a browser addon?

You can try to download the video locally and view it

@silverwind
Copy link
Member

Ah, yes, for whatever reason the video stayed black but it works after downloading.

The bug may be in https://github.com/github/relative-time-element. GitHub uses the same element, can you try to reproduce on github.com and check the console?

@lunny lunny added the type/upstream This is an issue in one of Gitea's dependencies and should be reported there label Jun 21, 2023
@hiifong
Copy link
Contributor Author

hiifong commented Jul 11, 2023

iShot_2023-07-11_14.19.02.mp4

@hiifong
Copy link
Contributor Author

hiifong commented Jul 11, 2023

iShot_2023-07-11_14.27.57.mp4

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jul 11, 2023

If you only post videos without a single word, I don't know what you are talking about.

And, I can not reproduce it.

@wxiaoguang wxiaoguang added issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed type/bug type/upstream This is an issue in one of Gitea's dependencies and should be reported there labels Jul 11, 2023
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jul 11, 2023

I will help to complete this issue's information:

Reproducible steps:

  1. Use Chrome to open a page with "relative-time" component, eg: the signed-in homepage try.gitea.io or a repo's home page like https://try.gitea.io/wxiaoguang/test
  2. Switch the language to a non-English one
  3. Click "Translate to ...." in the page's right-click context menu
  4. Then switch to the "Detected language"
  5. Then the "lang" attribute in <html> becomes "auto" (it's changed by the Google's translate plugin), it breaks https://github.com/github/relative-time-element

Screenshot of the bug:

image


How to fix:

  1. Let google fix its plugin (lang=auto seems incorrect)
  2. Let relative-time-element accept "auto"
  3. Add an extra (stable) "lang" attribute on <body>, then relative-time-element will find it by its this.closest('[lang]')?.getAttribute('lang')

@wxiaoguang wxiaoguang added type/bug issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail labels Jul 11, 2023
@yp05327
Copy link
Contributor

yp05327 commented Mar 21, 2024

It seems that this is not a bug from Gitea side, but from upstream?
Do we need to add the report-upstream label back?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

No branches or pull requests

5 participants