Skip to content

Commit

Permalink
Merge branch 'refs/heads/v3.6/next' into v3.6/203-212
Browse files Browse the repository at this point in the history
  • Loading branch information
YiiGuxing committed Jul 21, 2024
2 parents 28731d3 + cf49b91 commit f5f46ea
Show file tree
Hide file tree
Showing 35 changed files with 312 additions and 323 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## [Unreleased]

- The GPT-4o mini is now available in the OpenAI Translator engine.
- Alibaba Translate can now return the detected language.
- Bug fixes.
- GPT-4o mini 现已在 OpenAI 翻译引擎中可用
- 阿里翻译现在能返回检测到的语言
- Bug 修复

## [3.6.2] (2024/06/12)

- Bug fixes.
- Bug 修复

Expand Down Expand Up @@ -485,7 +494,8 @@
- 支持单词拆分。翻译变量名或方法名时更方便
- Bug修复

[Unreleased]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.1...HEAD
[Unreleased]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.2...HEAD
[3.6.2]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.1...v3.6.2
[3.6.1]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.6.0...v3.6.1
[3.6.0]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.5.8...v3.6.0
[3.5.8]: https://github.com/YiiGuxing/TranslationPlugin/compare/v3.5.7...v3.5.8
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<br/>
<p>
<b>
<a href="https://yiiguxing.github.io/TranslationPlugin/index.html">Website</a> |
<a href="https://intellij-translation.yiiguxing.top">Website</a> |
<a href="https://github.com/YiiGuxing/TranslationPlugin">GitHub</a> |
<a href="https://yiiguxing.github.io/TranslationPlugin/start.html">Get Started</a> |
<a href="https://intellij-translation.yiiguxing.top/start.html">Get Started</a> |
<a href="https://plugins.jetbrains.com/plugin/8579-translation/support-donate">Donate</a>
</b>
</p>
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ website. [[Become a sponsor][open-collective-contribute]]
[file:settings-font]: .github/readme/settings_font.png
[file:financial-contributors]: https://github.com/YiiGuxing/TranslationPlugin/blob/master/FINANCIAL_CONTRIBUTORS.md

[get-started-en]: https://yiiguxing.github.io/TranslationPlugin/en/start.html
[get-started-zh]: https://yiiguxing.github.io/TranslationPlugin/start.html
[get-started-ja]: https://yiiguxing.github.io/TranslationPlugin/ja/start.html
[get-started-ko]: https://yiiguxing.github.io/TranslationPlugin/ko/start.html
[get-started-en]: https://intellij-translation.yiiguxing.top/#/en/docs
[get-started-zh]: https://intellij-translation.yiiguxing.top/#/docs
[get-started-ja]: https://intellij-translation.yiiguxing.top/#/ja/docs
[get-started-ko]: https://intellij-translation.yiiguxing.top/#/ko/docs

[plugin-homepage]: https://plugins.jetbrains.com/plugin/8579-translation
[plugin-versions]: https://plugins.jetbrains.com/plugin/8579-translation/versions
Expand Down
8 changes: 6 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ tasks {
systemProperty("translation.plugin.log.stdout", true)

jbrVariant = "dcevm"
// Enable hotswap, requires JBR 17+ or JBR 11 with DCEVM, and run in debug mode.
jvmArgs = listOf("-XX:+AllowEnhancedClassRedefinition")
jvmArgs = listOf(
// Enable hotswap, requires JBR 17+ or JBR 11 with DCEVM, and run in debug mode.
"-XX:+AllowEnhancedClassRedefinition",
// Run the IDE in a specified language.
// "-Duser.language=en"
)

// Path to IDE distribution that will be used to run the IDE with the plugin.
// ideDir.set(File("path to IDE-dependency"))
Expand Down
4 changes: 2 additions & 2 deletions 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.2
pluginMajorVersion = 3.6.3
pluginPreReleaseVersion =
pluginBuildMetadata = 203u212
autoSnapshotVersion = true
Expand All @@ -32,7 +32,7 @@ platformPlugins = java, org.jetbrains.kotlin, \
kotlin.stdlib.default.dependency = false

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.7
gradleVersion = 8.9

# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache = true
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.intellij.ui.JBColor;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -88,9 +87,6 @@ public BalloonPopupBuilder(@NotNull final JComponent content) {
public BalloonPopupBuilder(@Nullable Map<Disposable, List<Balloon>> storage, @NotNull final JComponent content) {
myStorage = storage;
myContent = content;
if (UIUtil.isClientPropertyTrue(myContent, BalloonImpl.FORCED_NO_SHADOW)) {
myShadow = false;
}
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cn.yiiguxing.plugin.translate
import com.intellij.AbstractBundle
import com.intellij.DynamicBundle
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.util.registry.Registry
import org.jetbrains.annotations.PropertyKey
import java.util.*

Expand Down Expand Up @@ -32,10 +31,8 @@ open class TranslationDynamicBundle(private val pathToBundle: String) : Abstract
loader: ClassLoader,
control: ResourceBundle.Control
): ResourceBundle {
return dynamicLocale?.let { locale ->
val controlUsed = if (forceFollowLanguagePack) adaptedControl else control
ResourceBundle.getBundle(pathToBundle, locale, loader, controlUsed)
} ?: super.findBundle(pathToBundle, loader, control)
return dynamicLocale?.let { ResourceBundle.getBundle(pathToBundle, it, loader, control) }
?: super.findBundle(pathToBundle, loader, control)
}

fun getAdaptedMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String {
Expand All @@ -45,10 +42,6 @@ open class TranslationDynamicBundle(private val pathToBundle: String) : Abstract
companion object {
private val LOGGER = Logger.getInstance(TranslationDynamicBundle::class.java)

private val forceFollowLanguagePack: Boolean by lazy {
Registry.get("cn.yiiguxing.plugin.translate.bundle.forceFollowLanguagePack").asBoolean()
}

val dynamicLocale: Locale? by lazy {
try {
DynamicBundle.getLocale()
Expand All @@ -57,7 +50,5 @@ open class TranslationDynamicBundle(private val pathToBundle: String) : Abstract
null
}
}

}

}
6 changes: 3 additions & 3 deletions src/main/kotlin/cn/yiiguxing/plugin/translate/WebPages.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("unused", "MemberVisibilityCanBePrivate")

package cn.yiiguxing.plugin.translate

import cn.yiiguxing.plugin.translate.util.IdeVersion
Expand All @@ -17,7 +19,7 @@ import java.util.*
*/
object WebPages {

private const val BASE_URL = "https://yiiguxing.github.io/TranslationPlugin"
private const val BASE_URL = "https://intellij-translation.yiiguxing.top"

private val LOG = logger<WebPages>()

Expand Down Expand Up @@ -47,7 +49,6 @@ object WebPages {
/**
* Get the update page for the specified version.
*/
@Suppress("MemberVisibilityCanBePrivate")
fun updates(version: String = ""): PageFragment {
return get("updates").let { if (version.isEmpty()) it else it.resolvePath("v$version") }
}
Expand Down Expand Up @@ -151,7 +152,6 @@ object WebPages {
/** The language of the page. */
val language: Language = Language.CHINESE,
/** Whether to use compact mode. */
@Suppress("MemberVisibilityCanBePrivate")
val compact: Boolean = false,
) {
/** The path of the fragment. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ import cn.yiiguxing.plugin.translate.message
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.Presentation
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.project.Project
import javax.swing.Icon

class GettingStartedAction(icon: Icon? = null) :
open class GettingStartedAction(icon: Icon? = null) :
DumbAwareAction({ message("action.GettingStartedAction.text") }, Presentation.NULL_STRING, icon) {
override fun actionPerformed(e: AnActionEvent) {
WebPages.browse(
e.project,
WebPages.docs(),
message("help.getting.started", TranslationPlugin.name)
)
browse(e.project)
}

companion object {
fun browse(project: Project? = null) {
WebPages.browse(
project,
WebPages.docs(),
message("help.getting.started", TranslationPlugin.name)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ val Lang.aliLanguageCode: String
/**
* Returns the [language][Lang] for the specified Ali Translator language [code].
*/
@Suppress("unused")
fun Lang.Companion.fromAliLanguageCode(code: String): Lang {
return AliLanguageAdapter.getLanguage(code)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package cn.yiiguxing.plugin.translate.trans.ali

import cn.yiiguxing.plugin.translate.trans.TranslationResultException

class AliTranslationResultException(val errorCode: String, val errorMessage: String?) :
TranslationResultException(errorCode.toIntOrNull() ?: -1) {
override fun getLocalizedMessage(): String {
return "$message[$errorMessage]"
}
}
Loading

0 comments on commit f5f46ea

Please sign in to comment.