Skip to content

Commit

Permalink
fix chinese lang conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ttop32 committed Jan 12, 2024
1 parent a42f11a commit 1f31f34
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions doc/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Mouseover Translate Any Language At Once
English, Russian, Japanese, Chinese and so on

# Change Log
- 0.1.108
- add baidu
- support google doc hover
- 0.1.107
- fix intro site
- 0.1.106
Expand Down
1 change: 0 additions & 1 deletion src/popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ var tooltipAnimationList = {
"Shift-away": "shift-away",
"Shift-toward": "shift-toward",
Perspective: "perspective",
None: "",
};
var detectTypeList = {
Expand Down
4 changes: 2 additions & 2 deletions src/subtitle/youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ export default class Youtube extends BaseVideo {

static async getYoutubeMetaData(videoId) {
// use global variable
if (ytInitialPlayerResponse?.videoDetails?.videoId == videoId) {
return ytInitialPlayerResponse;
if (window?.ytInitialPlayerResponse?.videoDetails?.videoId == videoId) {
return window.ytInitialPlayerResponse;
}
var metadata = await this.getYoutubeMetaDataFromAPI(videoId);
if (metadata?.captions) {
Expand Down
4 changes: 3 additions & 1 deletion src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,9 @@ export function getDefaultLang() {

export function parseLocaleLang(localeLang) {
var lang = parse(localeLang).language;
return lang == "zh" ? localeLang : lang; // chinese lang code fix
lang = lang == "zh" ? "zh-CN" : lang; // chinese lang code fix
lang = localeLang == "zh-TW" ? "zh-TW" : lang;
return lang;
}

export async function getDefaultVoice() {
Expand Down

0 comments on commit 1f31f34

Please sign in to comment.