Empty translation files using QT internationalisation - qt

I am using QT and trying to generate .ts translation files using the pylupdate4 command.
I marked the strings I needed to translate with
self.tr('example string')
Unfortuanetly, the generated .ts files are empty.
I am in the src folder of the project and generate my own .pro file, which is also in the src folder. It looks like this:
SOURCE = rob_gui.py
TRANSLATIONS = en.ts \
germ.ts
rob_gui.py is also in the src folder.
Why are the .ts files empty?

Related

Can js file be compiled in a different folder from the source folder?

I'm building an Obsidian plugin, and it uses esbuild to bundle ts file to js file. The ts file is located at D:\foo1\foo2\..., and I want the js file to be at D:\bar1\bar2\.... The reason for this is because I want the source folder is in a different folder than the plugin folder, so that when syncing it to mobile I don't have to exclude the source files.
I was suggested to edit the esbuild.config.mjs file, and I find in the documentation that beside the outfile config there are also outdir, outbase. However, these are the results when I'm using them:
outdir
outdir: 'D:\Quả Cầu\B Nội dung\Knowledge graphs\Cây vấn đề\.obsidian\plugins\dotmaker'
error: Failed to create output directory: mkdir D:\GitHub\Obsidian\dotmaker\D:Quả CầuB Nội dungKnowledge graphsCây vấn đề.obsidianpluginsdotmaker: The directory name is invalid.
outbase
outbase: 'D:\Quả Cầu\B Nội dung\Knowledge graphs\Cây vấn đề\.obsidian\plugins\dotmaker',
It prints the js content in the terminal, but the real file isn't changed.
It seems that I can only create the js file inside the source folder. Is that possible?
You didn't correctly format the content of the outdir setting. When using backslashes \ as path separator on windows, you have to escape them. Ie use
outdir: 'D:\\Quả Cầu\\B Nội dung\\Knowledge graphs\\Cây vấn đề\\.obsidian\\plugins\\dotmaker'

Including a .pri file in multiple .pro project file with different relative paths

Hi I have some files in a dir called COMMON_SRC and a .pri file for these src files : Common.pri
and two projects in diffrent relative paths to common files.
I wanna use only one Common.pri file.
Can anyone help me?
Can I use some variable in each .pro file which tells the Common.pri file the relative path to project?
something like $$PWD ?
_PRO_FILE_PWD_ is what you want (docs).
If I understood your question correctly, assume You have a project tree like below:
/
├─common_src
├─test
└─lib
and you have common.pri in the common_src folder which points to source files. Imagine you like to include sources in test and lib projects.
So, change files path in common.pri in order to include current path as below:
SOURCES += \
$$PWD/document.cpp
HEADERS += \
$$PWD/document.h
now, include common sources in other projects as this:
lib.pro:
#...
include(../common_src/common.pri)
#...
This trick causes to included path be interpreted as relative to the current project path.

How to create a empty folder with QuaZIP

I've successfully created folders and files inside a ZIP file with QuaZIP, but to create a folder i used a not elegant way, that creates a file without name inside the ZIP file. Is there any way to create empty folders inside a ZIP file without create a file inside that folder?
Code to create folder:
QuaZip zip("path_to\\zipFile.zip");
zip.open(QuaZip::mdCreate);
QuaZipFile outFile(&zip);
outFile.open(QIODevice::WriteOnly, QuaZipNewInfo("SomeFolder\\"));
outFile.close();

Why does my JAR file not create a serialization?

I created a jar file from a Java project. I can even run it now, but it does not save the serialization file that is stored correctly when I run the program from normal binary code outside of the JAR file.
Can’t you create new files when you have a jar file?
This is how I write the file:
FileOutputStream fileOut = new FileOutputStream("data/vocabulary.ser");
ObjectOutputStream out = new ObjectOutputStream(fileOut);
out.writeObject(this);
out.close();
fileOut.close();
My JAR file looks like this:
META-INF
MANIFEST.MF
name
stefankoch
…
where name/stefankoch/… is my project namespace.
I tried creating a data directory in the jar-file (root), but it did not work either. There also is a data directory within the directory the jar-file resides in, but that one is not taken either.
How can I allow jar files to create files?
basically, you should not add information entered by the user into a JAR file, they belong to the user’s home directory.
This can be read with
System.getProperty("user.home")
And files within the user home directory can also be used from within a JAR file.

How do you include .java files and .html files in a .jar file when you take Clean and Build in Netbeans 7?

If you have files in the build/classes/folderToJar Netbeans7 takes the .class files and make a .jar file when you take Clean and Build.
But how can you have .java files and .html files go into the .jarfile as well?
First Create a package(Say html) under Source Packages
copy all of your html files to this package(when you create a package,a folder in the name of your package will be created inside your project src folder, so copy files to it)
You can access your html file from your program as
URL someURL = yourclass.class.getResource("/html/yourhtml.html");

Resources