Merge remote-tracking branch 'Meine/feature/LocalizeSelectedString' into feature/LocalizeSelectedString

# Conflicts:
#	src/main/java/de/marhali/easyi18n/action/LocalizeItAction.java
This commit is contained in:
JPilson 2023-12-16 18:05:25 +01:00
commit 697059bcdd
19 changed files with 139 additions and 59 deletions

View File

@ -34,7 +34,7 @@ jobs:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
# Validate wrapper
- name: Gradle Wrapper Validation
@ -42,7 +42,7 @@ jobs:
# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
@ -102,11 +102,11 @@ jobs:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
@ -155,18 +155,18 @@ jobs:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@v2023.2.1
uses: JetBrains/qodana-action@v2023.2.8
with:
cache-default-branch-only: true
@ -186,11 +186,11 @@ jobs:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
@ -233,11 +233,11 @@ jobs:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

View File

@ -20,13 +20,13 @@ jobs:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

View File

@ -33,11 +33,11 @@ jobs:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

View File

@ -4,23 +4,38 @@
## [Unreleased]
## [4.4.3] - 2023-12-08
### Added
- Support for all 2023.3 builds (233.*)
### Changed
- Replace deprecated apache commons utils
- Update dependencies
## [4.4.2] - 2023-09-02
### Added
- Support for all 2023.2 builds (232.*)
### Changed
- Translator tool window icon color
## [4.4.1] - 2023-02-19
### Changed
- Dropped support for IDE versions older than 2022.2
- Updated dependencies
- Removed deprecated API access (TranslatorToolWindowFactory)
- Replaced YAML mapping with own implementation
### Fixed
- Support for all 2023.1 builds (231.*)
- Exception on file change listener
- Broken badge link in README
@ -28,72 +43,89 @@
## [4.4.0]
### Added
- Support of path variables for the locales directory configuration @SIMULATAN
### Changed
- Restructure form actions to improve user experience
## [4.3.1]
### Fixed
- Support for all 2022.3 builds (223.*)
## [4.3.0]
### Added
- Support for IntelliJ Platform version 2022.3
- Regex support for translation file patterns
### Changed
- Reload function internally consolidated
### Fixed
- Parsing for <kbd>.properties</kbd> files
## [4.2.4]
### Changed
- Improved exception handling on syntax errors
### Fixed
- Some settings are not retained on IDE restarts
## [4.2.3]
### Changed
- Removed warning about missing configuration during project initialization
### Fixed
- Folding support for Vue files
## [4.2.2]
### Changed
- Documentation provider better focuses on the actual translation part
- Color duplicate translation values orange to increase contrast in light themes
### Fixed
- Unintended overwrite of existing folding regions
## [4.2.1]
### Changed
- Updated dependencies
### Fixed
- Downgrade java to fix compatibility issues
## [4.2.0]
### Added
- Support for IntelliJ Platform version 2022.2
### Changes
- Updated dependencies
## [4.1.1]
### Fixed
- AssertionError on translation update
- Use correct line separator in <kbd>properties</kbd> files
- Allow numbers and other data types in <kbd>properties</kbd> files
@ -101,6 +133,7 @@
## [4.1.0]
### Added
- Duplicate translation values filter
- Indicate translations with duplicated values yellow
- Multiple translation filters can be used together
@ -108,18 +141,22 @@
- Reformat translation files based on IDE preferences
### Changed
- Reengineered how translation filters are applied internally
### Fixed
- Exception during batch delete
- Translation filters keep their status across updates
## [4.0.0]
### BREAKING CHANGES
- Configuration rework. Existing settings will be lost and must be configured via the new configuration page
### Added
- Key delimiters (namespace / section) can be configured
- Extract translation intention
- Full language support for Java, Kotlin, JavaScript / TypeScript, Vue and PHP
@ -129,65 +166,79 @@
- Dedicated configuration file (easy-i18n.xml) inside <kbd>.idea</kbd> folder
### Changed
- Editor assistance has been reengineered. This will affect key suggestion and annotation
- Moved configuration dialog into own page inside <kbd>IDE Settings</kbd>
### Fixed
- AlreadyDisposedException on FileChangeListener after project dispose
- Request-URL limit for error reports
## [3.2.0]
### Added
- Support for IntelliJ 2022.1
### Changed
- Updated dependencies
## [3.1.0]
### Added
- Support for Json5 files
## [3.0.1]
### Changed
- Fresh projects will receive a notification instead of an exception to configure the plugin
### Fixed
- Exception on json array value mapping
## [3.0.0]
### BREAKING CHANGES
- The local file structure of your translation files must be configured in the settings menu
### Added
- Modularization supports namespace or locale module
- Full namespace / locale module support for all file types
- Support for object and array elements inside json arrays
- IDE integrated error report functionality
### Changed
- Improve exception handling on IO operations
- Update dependencies
### Fixed
- Character unescaping for '.properties' files
- Exception on json files without any content
## [2.0.0]
### BREAKING CHANGES
- Translation file pattern matcher needs to be updated to <kbd>\*.*</kbd> or equivalent wildcard rule
- I18n key nesting will now escape every delimiter within a section layer (can be inverted via option)
### Added
- Filter functionality for translations with missing values
- Full keyboard shortcut support inside tool-window
- Support for dots within key nodes in YAML files
### Changed
- Improve marking nodes with missing values in tree-view
- Key completion inside editor suggests all keys without any logic
- Translation file pattern uses wildcard matcher instead of regex
@ -196,31 +247,37 @@
- Allow tool-window rendering in dumb mode
### Fixed
- First row inside table view is not editable
- Key focus within tree or table view after translation change
## [1.7.1]
### Fixed
- Vue.js template folding support
## [1.7.0]
### Added
- Partial support for translation key folding against actual translation
- Support for json based arb files (flutter)
### Changed
- Updated plugin dependencies
- Use actual file extension to choose io strategy
### Fixed
- NullPointerException on key completion
- Changelog handling in release flow
## [1.6.0]
### Added
- The search function now supports full-text-search
- Automatically reload translation data on file system change
- Sorting of translation keys can now be disabled via configuration
@ -229,6 +286,7 @@
- Code signing of plugin source
### Changed
- Better focus keys in tree-view after edit
- Optimized internal data structure (io, cache, events)
- Adjusted compatibility matrix to 2020.3 - 2021.3
@ -237,35 +295,43 @@
## [1.5.1]
### Fixed
- Exception on key annotation if path-prefix is undefined
## [1.5.0]
### Added
- Support for YAML locale files. Thanks to @sunarya-thito
- Translation key referencing inside editor
- Optional path-prefix for translations
### Changed
- Optimized i18n key completion
### Fixed
- Locale file pattern configuration
## [1.4.1]
### Added
- Support for IntelliJ 2021.2
### Changed
- Replace deprecated api methods
### Fixed
- Warning for unset target element inside tree-view toolbar
## [1.4.0]
### Added
- Basic support for json array values
- Settings option to opt-out code assistance inside editor
- Support key completion and annotation for Kotlin language
@ -273,64 +339,78 @@
- Donation links on GitHub to support development
### Changed
- Update dependencies
- Migrate gradle build script
## [1.3.0]
### Added
- Scroll to created / edited translation inside Tree-/Table-View
- Support for working with multiple projects at once
### Changed
- Update dependencies
- Load translations even if ui tool window is not opened
### Fixed
- NullPointerException's on translation annotation / completion inside editor
- Always synchronize ui with loaded state by reloadFromDisk function
## [1.2.0]
### Added
- Sorting for properties files
### Fixed
- Unexpected character escaping for json/properties files / issue #10
## [1.1.1]
### Added
- Support for IntelliJ 2021.1
### Changed
- Update dependencies
### Fixed
- Exception during i18n key completion / annotation
## [1.1.0] - 2021-04-25
### Added
- Filter option for translation files via regex / issue #5
- Support for splitted / modularized json files per locale / issue #4
- Basic translation key completion inside editor
- I18n key annotation inside editor
### Changed
- Tree view will be expanded if search function has been used
### Fixed
- Encoding for properties files / issue #6
## [1.0.1] - 2021-03-16
### Changed
- Modified plugin icon to meet IntelliJ guidelines
## [1.0.0] - 2021-03-15 (release)
### Added
- Support for JSON and Resource-Bundle(Properties) based locale files
- UI Tool Window with Table- and Tree-View representation
- Add / Edit / Delete functions
@ -342,9 +422,11 @@
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
### Changed
- README.md
[Unreleased]: https://github.com/marhali/easy-i18n/compare/v4.4.2...HEAD
[Unreleased]: https://github.com/marhali/easy-i18n/compare/v4.4.3...HEAD
[4.4.3]: https://github.com/marhali/easy-i18n/compare/v4.4.2...v4.4.3
[4.4.2]: https://github.com/marhali/easy-i18n/compare/v4.4.1...v4.4.2
[4.4.1]: null/compare/v4.4.0...v4.4.1
[4.4.0]: null/compare/v4.3.1...v4.4.0

View File

@ -29,7 +29,11 @@ dependencies {
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain(17)
@Suppress("UnstableApiUsage")
jvmToolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.JETBRAINS
}
}
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html

View File

@ -4,22 +4,22 @@ pluginGroup = de.marhali.easyi18n
pluginName = easy-i18n
pluginRepositoryUrl = https://github.com/marhali/easy-i18n
# SemVer format -> https://semver.org
pluginVersion = 4.4.2
pluginVersion = 4.4.3
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 223
pluginUntilBuild = 232.*
pluginUntilBuild = 233.*
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IU
platformVersion = 2023.2.1
platformVersion = 2023.3
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = org.jetbrains.kotlin, JavaScript, com.jetbrains.php:232.9559.64
platformPlugins = org.jetbrains.kotlin, JavaScript, com.jetbrains.php:233.11799.241
# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.3
gradleVersion = 8.5
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false

View File

@ -1,14 +1,14 @@
[versions]
# libraries
annotations = "24.0.1"
annotations = "24.1.0"
json5-java = "2.0.0"
# plugins
kotlin = "1.9.0"
changelog = "2.1.2"
gradleIntelliJPlugin = "1.15.0"
kotlin = "1.9.21"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.16.1"
qodana = "0.1.13"
kover = "0.7.3"
kover = "0.7.5"
[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

14
gradlew vendored
View File

@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

View File

@ -3,7 +3,7 @@
version: 1.0
linter: jetbrains/qodana-jvm-community:latest
projectJDK: 17
projectJDK: "17"
profile:
name: qodana.recommended
exclude:

View File

@ -1,5 +1,5 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.6.0"
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}
rootProject.name = "easy-i18n"

View File

@ -1,8 +1,7 @@
package de.marhali.easyi18n.io.parser;
import de.marhali.easyi18n.util.StringUtil;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import java.text.MessageFormat;
import java.util.Iterator;

View File

@ -7,9 +7,8 @@ import com.google.gson.JsonPrimitive;
import de.marhali.easyi18n.model.TranslationNode;
import de.marhali.easyi18n.model.TranslationValue;
import de.marhali.easyi18n.util.StringUtil;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.text.StringEscapeUtils;
import java.util.Map;
@ -61,7 +60,7 @@ public class JsonMapper {
if(content != null) {
if(JsonArrayMapper.isArray(content)) {
json.add(key, JsonArrayMapper.write(content));
} else if(NumberUtils.isNumber(content)) {
} else if(NumberUtils.isCreatable(content)) {
json.add(key, new JsonPrimitive(NumberUtils.createNumber(content)));
} else {
json.add(key, new JsonPrimitive(StringEscapeUtils.unescapeJava(content)));

View File

@ -5,8 +5,7 @@ import de.marhali.easyi18n.util.StringUtil;
import de.marhali.json5.Json5;
import de.marhali.json5.Json5Array;
import de.marhali.json5.Json5Primitive;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.io.IOException;
@ -40,7 +39,7 @@ public class Json5ArrayMapper extends ArrayMapper {
} else {
if(StringUtil.isHexString(element)) {
array.add(Json5Primitive.of(element, true));
} else if(NumberUtils.isNumber(element)) {
} else if(NumberUtils.isCreatable(element)) {
array.add(Json5Primitive.of(NumberUtils.createNumber(element)));
} else {
array.add(Json5Primitive.of(element));

View File

@ -6,9 +6,8 @@ import de.marhali.easyi18n.util.StringUtil;
import de.marhali.json5.Json5Element;
import de.marhali.json5.Json5Object;
import de.marhali.json5.Json5Primitive;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.text.StringEscapeUtils;
import java.util.Map;
@ -61,7 +60,7 @@ public class Json5Mapper {
json.add(key, Json5ArrayMapper.write(content));
} else if(StringUtil.isHexString(content)) {
json.add(key, Json5Primitive.of(content, true));
} else if(NumberUtils.isNumber(content)) {
} else if(NumberUtils.isCreatable(content)) {
json.add(key, Json5Primitive.of(NumberUtils.createNumber(content)));
} else {
json.add(key, Json5Primitive.of(StringEscapeUtils.unescapeJava(content)));

View File

@ -5,9 +5,8 @@ import de.marhali.easyi18n.model.KeyPath;
import de.marhali.easyi18n.model.TranslationValue;
import de.marhali.easyi18n.util.KeyPathConverter;
import de.marhali.easyi18n.util.StringUtil;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.text.StringEscapeUtils;
import java.util.Map;
@ -51,7 +50,7 @@ public class PropertiesMapper {
if(PropertiesArrayMapper.isArray(content)) {
properties.put(simpleKey, PropertiesArrayMapper.write(content));
} else if(NumberUtils.isNumber(content)) {
} else if(NumberUtils.isCreatable(content)) {
properties.put(simpleKey, NumberUtils.createNumber(content));
} else {
properties.put(simpleKey, StringEscapeUtils.unescapeJava(content));

View File

@ -3,9 +3,8 @@ package de.marhali.easyi18n.io.parser.yaml;
import de.marhali.easyi18n.model.TranslationNode;
import de.marhali.easyi18n.model.TranslationValue;
import de.marhali.easyi18n.util.StringUtil;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.text.StringEscapeUtils;
import java.util.HashMap;
import java.util.List;
@ -53,7 +52,7 @@ public class YamlMapper {
if(content != null) {
if(YamlArrayMapper.isArray(content)) {
section.put(key, YamlArrayMapper.write(content));
} else if(NumberUtils.isNumber(content)) {
} else if(NumberUtils.isCreatable(content)) {
section.put(key, NumberUtils.createNumber(content));
} else {
section.put(key, StringEscapeUtils.unescapeJava(content));

View File

@ -24,7 +24,7 @@ public class StringUtil {
/**
* Escapes control characters for the given input string.
* Inspired by Apache Commons (see {@link org.apache.commons.lang.StringEscapeUtils}
* Inspired by Apache Commons (see {@link org.apache.commons.text.StringEscapeUtils}
* @param input The input string
* @param skipStrings Should every string literal indication ("", '') be skipped? (Needed e.g. for json)
* @return Escaped string