Skip to content

Commit

Permalink
Merge branch 'v3.6/next' into v3.6/203-212
Browse files Browse the repository at this point in the history
  • Loading branch information
YiiGuxing committed Oct 2, 2024
2 parents 8091bab + 77fb603 commit afb2e55
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## [Unreleased]

- User interaction experience optimization and improvement.
- Bug fixes.
- 用户交互体验优化与改进
- Bug 修复

## [3.6.5] (2024/09/17)

- DeepL Translator now supports languages such as Chinese Traditional.
- User interaction experience optimization and improvement.
- Bug fixes.
Expand Down Expand Up @@ -512,7 +519,8 @@
- 支持单词拆分。翻译变量名或方法名时更方便
- Bug修复

[Unreleased]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.4...HEAD
[Unreleased]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.5...HEAD
[3.6.5]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.4...v3.6.5
[3.6.4]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.3...v3.6.4
[3.6.3]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.2...v3.6.3
[3.6.2]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.1...v3.6.2
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pluginGroup = cn.yiiguxing.plugin.translate
pluginRepositoryUrl = https://github.com/YiiGuxing/TranslationPlugin

# SemVer format -> https://semver.org
pluginMajorVersion = 3.6.5
pluginMajorVersion = 3.6.6
pluginPreReleaseVersion =
pluginBuildMetadata = 203u212
autoSnapshotVersion = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cn.yiiguxing.plugin.translate.service

import cn.yiiguxing.plugin.translate.TranslationStorages
import cn.yiiguxing.plugin.translate.trans.Lang
import cn.yiiguxing.plugin.translate.trans.Lang.Companion.isExplicit
import cn.yiiguxing.plugin.translate.trans.Translation
import cn.yiiguxing.plugin.translate.util.*
import com.intellij.openapi.components.*
Expand Down Expand Up @@ -30,17 +31,19 @@ class CacheService : PersistentStateComponent<CacheService.State> {

fun putMemoryCache(text: String, srcLang: Lang, targetLang: Lang, translatorId: String, translation: Translation) {
memoryCache.put(MemoryCacheKey(text, srcLang, targetLang, translatorId), translation)
if (Lang.AUTO == srcLang) {
memoryCache.put(MemoryCacheKey(text, translation.srcLang, targetLang, translatorId), translation)

val srcLangToCache = when {
srcLang.isExplicit() -> srcLang
translation.srcLang.isExplicit() -> translation.srcLang
else -> return
}
if (Lang.AUTO == targetLang) {
memoryCache.put(MemoryCacheKey(text, srcLang, translation.targetLang, translatorId), translation)
val targetLangToCache = when {
targetLang.isExplicit() -> targetLang
translation.targetLang.isExplicit() -> translation.targetLang
else -> return
}
if (Lang.AUTO == srcLang && Lang.AUTO == targetLang) {
memoryCache.put(
MemoryCacheKey(text, translation.srcLang, translation.targetLang, translatorId),
translation
)
if (srcLangToCache != srcLang || targetLangToCache != targetLang) {
memoryCache.put(MemoryCacheKey(text, srcLangToCache, targetLangToCache, translatorId), translation)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ object DeeplSupportedLanguages : SupportedLanguages {
Lang.CZECH,
Lang.DANISH,
Lang.DUTCH,
Lang.ENGLISH,
Lang.ENGLISH_AMERICAN,
Lang.ENGLISH_BRITISH,
Lang.ESTONIAN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ internal object EdgeTTSVoiceManager {
BENGALI to "bn-IN",
BULGARIAN to "bg-BG",
CATALAN to "ca-ES",
CHINESE to "zh-CN",
CHINESE_SIMPLIFIED to "zh-CN",
CHINESE_CANTONESE to "zh-HK",
CHINESE_TRADITIONAL to "zh-CN",
Expand Down

0 comments on commit afb2e55

Please sign in to comment.