Lazarus
Using the Lazarus IDE => Options => Topic started by: lainz on March 28, 2018, 07:10:41 pm
-
Hi, I've made a configuration in project options so the i18n is in the project folder like this:
project\i18n
Po are generated fine.
The thing I want to do is copy contents of i18n folder to
project\bin\debug\$(TargetCPU)-$(TargetOS)\locale\
So when I'm debugging I can test translations as well.
I want to do this from the IDE that's the tool I use to compile.
-
I want to do this from the IDE that's the tool I use to compile.
You've tried "Execute after" in project options, right?
For example, for a project created by LazXProj, it always runs this to make sure the version info and install scripts are updated:
"$PKGDIR(AppXProj)/../utils/fix_xproj$ExeExt()" "$Project(InfoFile)"
-
Thanks, I think this is not cross platform, right? I need to make an executable for each platform I'm using with Lazarus.
I was thinking something like PascalScript or similar.
-
Thanks, I think this is not cross platform, right? I need to make an executable for each platform I'm using with Lazarus.
Not sure if I follow. I would say it is cross-platform. Maybe not very well documented, but I haven't found situations where I needed a separate .lpi, for example. Use the macros ($).
-
Not sure if I follow. I would say it is cross-platform. Maybe not very well documented, but I haven't found situations where I needed a separate .lpi, for example. Use the macros ($).
I mean I need a different batch file for each OS I run that Execute after. Not something like run a PascalScript that does the copy of the files with no need of batch.
-
I mean I need a different batch file for each OS I run that Execute after. Not something like run a PascalScript that does the copy of the files with no need of batch.
Run a compiled Pascal console app to do it. Only need one for that.
I've never found a use for Pascal Script.
-
That's ok. I will try that.
-
That's ok. I will try that.
If you put it in a package, as in my example above, you can add the command to your project options without worrying about where it actually is, by specifying its path with $PKGDIR().
In my example, the console app is relative to a known package, so it's slightly more complicated.
See Lazarus Cross-Platform Project for source:
https://macpgmr.github.io/
-
Your application probably saves its settings in an ini or cfg file. Add a setting for the Languages folder. After first run of the application edit the ini file and change the entry for the Languages folder to point to the "project\i18n" -- this way is is not necessary at all to copy files around.
-
this way is is not necessary at all to copy files around.
I assumed that he was copying files into the structure he uses with the installed app on Windows and Linux (but not macOS, since path doesn't make sense there).
-
Yes, I have a json cfg file stored in the user app data folder.
I'm using DefaulTranslator so I don't know if I can change that folder path. Maybe there is a parameter I can send to the app when it starts. But I don't know if is available.
About Mac, I don't have one. I'm running it on a slow VM. I'm not sure where DefaulTranslator looks for translation on a Mac. Will be nice to know more about it.
-
About Mac, I don't have one. I'm running it on a slow VM. I'm not sure where DefaulTranslator looks for translation on a Mac. Will be nice to know more about it.
I'm not aware of any apps on Mac that use .po files for localization. Most use a combination of .strings and .nib files under the locale's folder (eg, MyApp.app/Contents/Resources/en.lproj for English). GIMP uses .mo files - maybe something similar to .po?
Note that Mac apps generally don't use .cfg, etc. files. Preferences are stored under ~/Library/Preferences, etc. See the list here:
https://macpgmr.github.io/MacXPlatform/PascalAndMapbox_3.html#MiscNotes
-
I'm using the cross platform way Lazarus provides for config and translations. But I don't know the exact details. How these work.
-
I'm using the cross platform way Lazarus provides for config and translations.
I feel your pain.
Just in case anyone is interested in how Mac and iOS developers do it:
https://developer.apple.com/internationalization/