Skip to content

automatically copy locales#34

Merged
cerqiest merged 2 commits intomainfrom
copy-locales
Apr 16, 2025
Merged

automatically copy locales#34
cerqiest merged 2 commits intomainfrom
copy-locales

Conversation

@cerqiest
Copy link
Collaborator

uses an array of default locale names, loops through them, and saves them to the directory using the JavaPlugin#saveResource method

@cerqiest cerqiest requested a review from zNotChill as a code owner April 16, 2025 22:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to automatically copy default locale files from the plugin resources to the locales folder during startup. Key changes include:

  • Removal of the explicit creation of the locales directory in LocaleManager.
  • Addition of code in Rocket.kt to copy the default locale "en_GB" to the locales folder.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/main/kotlin/dev/znci/rocket/i18n/LocaleManager.kt Removed explicit directory creation for the locales folder, which may impact file listing if the folder does not exist.
src/main/kotlin/dev/znci/rocket/Rocket.kt Introduced a default locales array and resource copy logic using saveResource.
Comments suppressed due to low confidence (1)

src/main/kotlin/dev/znci/rocket/i18n/LocaleManager.kt:73

  • Removing the explicit directory creation may lead to issues when listing files if the locales folder does not exist. Consider re-adding the mkdirs() call or ensuring the folder's existence elsewhere before listing files.
if (!langFolder.exists()) langFolder.mkdirs()

@cerqiest
Copy link
Collaborator Author

Pull Request Overview

This PR aims to automatically copy default locale files from the plugin resources to the locales folder during startup. Key changes include:

  • Removal of the explicit creation of the locales directory in LocaleManager.
  • Addition of code in Rocket.kt to copy the default locale "en_GB" to the locales folder.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/main/kotlin/dev/znci/rocket/i18n/LocaleManager.kt Removed explicit directory creation for the locales folder, which may impact file listing if the folder does not exist.
src/main/kotlin/dev/znci/rocket/Rocket.kt Introduced a default locales array and resource copy logic using saveResource.
Comments suppressed due to low confidence (1)
src/main/kotlin/dev/znci/rocket/i18n/LocaleManager.kt:73

  • Removing the explicit directory creation may lead to issues when listing files if the locales folder does not exist. Consider re-adding the mkdirs() call or ensuring the folder's existence elsewhere before listing files.
if (!langFolder.exists()) langFolder.mkdirs()

saveResource creates the locales folder automatically

Copy link
Contributor

@zNotChill zNotChill left a comment

Choose a reason for hiding this comment

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

lgtm

@cerqiest cerqiest merged commit e370280 into main Apr 16, 2025
6 checks passed
@github-actions
Copy link

github-actions bot commented Apr 16, 2025

Qodana Community for JVM

42 new problems were found

Inspection name Severity Problems
Usage of redundant or deprecated syntax or deprecated symbols 🔶 Warning 33
Unused symbol 🔶 Warning 6
Class member can have 'private' visibility ◽️ Notice 2
Condition of 'if' expression is constant ◽️ Notice 1

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@cerqiest cerqiest deleted the copy-locales branch April 19, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants