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

fix: detect Chinese language and refine the translation #3323

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

dangehub
Copy link
Contributor

@dangehub dangehub commented Feb 11, 2025

Types of changes

Changes visible to users:

Internal changes:

  • Refactor (prefix: refactor - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)

Description

  1. refactor: remove i18next-browser-languagedetector dependency
  2. fix: resolve bug with Chinese translation not displaying
  3. refactor: optimize Chinese translations

Motivation and Context

The new Chinese translation of 7.15.0 is not effective. · Issue #3322 · obsidian-tasks-group/obsidian-tasks

How has this been tested?

I used version 1.8.4 of Obsidian, and tested language switching on both macOS and Windows environments, and it works well.

Screenshots (if appropriate)

win

mac

Checklist

Terms

fix: resolve bug with Chinese translation not displaying
refactor: optimize Chinese translations
Copy link

sonarqubecloud bot commented Feb 11, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@claremacrae claremacrae added the scope: internationalisation Translations - Making the plugin work well for non-English-language users - also known as i18n label Feb 11, 2025
Copy link
Collaborator

@claremacrae claremacrae left a comment

Choose a reason for hiding this comment

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

This is great - thank you very much. This is a much better fix.

I'm going to go ahead and merge, to do the release.

If you have a chance to add any comments about the things I asked, it would be much appreciated.

@@ -12,6 +12,7 @@ module.exports = {
'^.+\\.ts$': 'ts-jest',
},
moduleFileExtensions: ['js', 'ts', 'svelte'],
testEnvironment: 'jsdom',
Copy link
Collaborator

Choose a reason for hiding this comment

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

For my own education, what is this for please?

import en from './locales/en.json';
import zh_cn from './locales/zh_cn.json';

let isInitialized = false;

// Get Obsidian language settings
const getObsidianLanguage = (): string => {
return localStorage.getItem('language')?.toLowerCase() || 'en';
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the thinking behind toLowerCase()?

@claremacrae claremacrae merged commit e1b0016 into obsidian-tasks-group:main Feb 11, 2025
3 checks passed
@claremacrae claremacrae changed the title fix: resolve bug with Chinese translation not displaying and refined the translation fix: detect Chinese language and refine the translation Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: internationalisation Translations - Making the plugin work well for non-English-language users - also known as i18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The new Chinese translation of 7.15.0 is not effective.
2 participants