Hi,
I'm trying and run a script to extract text fom a file and I have the following problem:
when I click on "Tool" then "Script", the pop-up window that opens is blank.
when I try to define the folder for the script, I can't access the "Script" folder within the "Java" folder which is located in the "Content" folder of the application OmegaT (I'm using a Mac) because I can't right-click on the icon OmegaT to go past it and select the "Script" folder since the icon OmegaT is not a file.
"Le script « /Applications/Script OmegaT/extract_text_content.groovy » est en cours d’exécution…
Une erreur s’est produite
javax.script.ScriptException: java.util.MissingResourceException: ResourceBundle (.properties file for localization) is missing."
I don't know what I'm doing wrong.
Thank you in advance for your help.
Ticket moved from /p/omegat/bugs/1289/
Edit: "since the icon OmegaT is not a folder"
Hello, I think the issue here might be that the
propertiessub directory was not copied when copying thescriptsdirectory. Thepropertiesdirectory holds localization files with the ".properties" extension.Removing that directory and trying to run a script gives me the same error.
Could you check if copying the directory helps?
I don't think there's any explanation in the docs regarding this directory. Is this something we should document @brandelune ? Or we could check if the directory is present and provide a clearer error message.
I think you are right regarding the script launching issue. And we should document that, indeed.
But the main issue is that in macOS the script folder is not accessible from the UI, even though it is packaged in OmegaT.app.
@miurahr9 If we notarize the 6.0.2 OmegaT.app package, the OS will not allow anymore modifications to the contents of the OmegaT.app package.
Hence, we need to relocate the
scriptsdirectory to an external location, as we did for the manual in https://sourceforge.net/p/omegat/feature-requests/1777/.Would you mind checking if you can handle that?
@brandelune Could you tell me which issue ticket for improvement of
scriptsfolder? I want to start a topic branch for it.I can create a new issue, but this one (1781) is good in my opinion.
Where is a scripting specification?
There is no content for script developers.
https://omegat.readthedocs.io/en/latest/51.HowToWriteScript/
How is that related to the script folder location that we are discussing here ?
I have raised the PR to add ADR of scripting feature, developer manual to explain SPI and folder detection, and explanation of sample scripts.
https://github.com/omegat-org/omegat/pull/1835
To notarize and publish OmegaT 6.0.2 we need to externalize the script folder, like we did for the manual folder.
We can imagine the following behavior at first launch:
The initialization of scrips folder should be done in very early stage of the application start. It is impossible to ask user in the stage.
We can take another strategy.
The "event based action" folders are automatically created since 6.0, which means that pre-6.0 can have a normally populated script folder but without "event based action" folders.
In that case, I don’t think overriding with default scripts in the good choice. That indicates a system that is being upgraded from pre-6.0 to 6.0+, in which case I think we should just add the non existing "event based action" folders.
What do you think?
Thank you for notification of historical evidence. So what is practical (easy to implement and less problematic ) way to detect installation?
Ok, so, the
scriptfolder is in the application folder for any version of OmegaT. Some users know that it can be in the configuration folder and put either all or a part of the scripts in the configuration folder.So the easiest and safest way to solve the issue is to check whether there is a
scriptfolder in the configuration folder. If there is none, install the scripts, if there is one, consider that it is user action and do not install anything.What do you think?
There is no
scriptfolder in the application folder in my OmegaT installation. There isscriptfolder in the configuration folder which is created when OmegaT open the project.Addtional comment;
I think there is incosistency in folder usage.
Sorry, it should have been
scripts.The folder you mention is an old artifact that was used as a very primitive API to access segment contents.
It has no relation whatsoever with what we call "scripts" here.
The
scriptsfolder is what we discuss here and it is by default in the application folder.Maybe it is time to rename that old
scriptfolder to something more explicit, and keepscriptsfor the OmegaT distributed scripts.@miurahr9 did you consider this comment of mine in the current implementation?
I reflect your comment in the another PR#1859
https://github.com/omegat-org/omegat/pull/1859/changes
A proposal of implementation for 6.0 branch has been raised as PR#1833
https://github.com/omegat-org/omegat/pull/1833
Please review it.