BJWielink / LabelTranslate

Simple and rushed PHP label translation plugin
3 stars 2 forks source link

PhpStorm 2024.1.4 support #4

Closed nzkozar closed 3 weeks ago

nzkozar commented 1 month ago

Hi, this plugin's page at https://plugins.jetbrains.com/plugin/23070-labeltranslate states that this plugin is not compatible with the latest version of PhpStorm which at this time is 2024.1.4

Would it be possible to update the plugin so it would be compatible?

If you can put together a simple step by step guide on what needs to be done, I can try to prepare the required changes myself. I started this PR, to get the ball rolling: https://github.com/BJWielink/LabelTranslate/pull/5

BJWielink commented 1 month ago

Hi,

There are currently two things wrong with the plugin:

  1. It does not seem to be compatible with the latest PhpStorm. I haven't look into it yet, but I assume this is simply a wrong version number.
  2. The labels get mixed up (at least in Linux). This means that it can appear as if you're editing the English translation, while in actuality you're editing the Dutch (for example) translation.

As far as I can see you've solved the first issue, but the second issue is somewhat more cumbersome. Since I rushed this plugin, it requires a tad bit more work to make a fix for this.

I will accept your PR and see if JetBrains stops worrying about compatibility issues.

If you'd be able to fix the second issue, I will merge that as well. But be warned: the code is a warzone ;).

CrazyBoy49z commented 1 month ago

@BJWielink works. But not work with laravel 10

https://github.com/BJWielink/LabelTranslate/blob/main/src/main/kotlin/org/label/translate/labeltranslate/TranslationSet.kt#L72

in laravel 10 path /lang

CrazyBoy49z commented 1 month ago

If the file has been deleted, an exception is thrown

java.io.FileNotFoundException: ***/resources/lang/ua/validation-attributes.php (No such file or directory)
    at java.base/java.io.FileOutputStream.open0(Native Method)
    at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
    at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
    at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:184)
    at org.label.translate.labeltranslate.SaveContext.saveLanguage(SaveContext.kt:33)
    at org.label.translate.labeltranslate.SaveContext.overwriteChanges(SaveContext.kt:10)
    at org.label.translate.labeltranslate.LabelTranslateToolWindowContent.createButtonPanel$lambda$3(LabelTranslateToolWindowFactory.kt:133)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
    at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6657)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3385)
    at java.desktop/java.awt.Component.processEvent(Component.java:6422)
    at java.desktop/java.awt.Container.processEvent(Container.java:2266)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4969)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4583)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4524)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2809)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:794)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:766)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:764)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:763)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:699)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.kt:638)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:584)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:138)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:129)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:584)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:77)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:362)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:361)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:843)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:361)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:356)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1022)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:114)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1022)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:356)
    at com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:209)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:398)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
CrazyBoy49z commented 1 month ago

2. The labels get mixed up (at least in Linux). This means that it can appear as if you're editing the English translation, while in actuality you're editing the Dutch (for example) translation.

This problem is also on macbook

BJWielink commented 1 month ago

I assume it's unix related (core problem lies in my code mess however). Either way, I don't have motivation to fix this plugin. Feel free to make a PR.

I have since tried to make a better version of this plugin: https://github.com/BJWielink/label-translate (with support for hierarchical translations, file system automatic saves and reloads, searching translations). This code is better in my opinion, but it still lacks the basic features (adding, updating, deleting). It also has a bug with the VFS that sends the events too soon (or late, I cant remember) so the plugin view gets unsynchronized.

I however have no motivation to finish it at the time being.

BJWielink commented 3 weeks ago

This

Hi,

There are currently two things wrong with the plugin:

  1. It does not seem to be compatible with the latest PhpStorm. I haven't look into it yet, but I assume this is simply a wrong version number.
  2. The labels get mixed up (at least in Linux). This means that it can appear as if you're editing the English translation, while in actuality you're editing the Dutch (for example) translation.

As far as I can see you've solved the first issue, but the second issue is somewhat more cumbersome. Since I rushed this plugin, it requires a tad bit more work to make a fix for this.

I will accept your PR and see if JetBrains stops worrying about compatibility issues.

If you'd be able to fix the second issue, I will merge that as well. But be warned: the code is a warzone ;).

Both theses issue are fixed in version 1.5 that is available in the PHPStorm plugins hence I am closing this issue.