Copy i18n to build folder lazarus / 11-Options ---------------------------------------------------------------------- lainz · 2018-03-28 17:10 Hi, I've made a configuration in project options so the i18n is in the project folder like this: Quoteproject\i18n Po are generated fine. The thing I want to do is copy contents of i18n folder to Quoteproject\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. ---------------------------------------------------------------------- Phil · 2018-03-28 17:37 Quote from: lainz on March 28, 2018, 07:10:41 pmI 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)" ---------------------------------------------------------------------- lainz · 2018-03-28 17:56 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. ---------------------------------------------------------------------- Phil · 2018-03-28 17:59 Quote from: lainz on March 28, 2018, 07:56:15 pmThanks, 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 ($). ---------------------------------------------------------------------- lainz · 2018-03-28 18:04 Quote from: Phil on March 28, 2018, 07:59:55 pmNot 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. ---------------------------------------------------------------------- Phil · 2018-03-28 18:09 Quote from: lainz on March 28, 2018, 08:04:30 pmI 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. ---------------------------------------------------------------------- lainz · 2018-03-28 18:15 That's ok. I will try that. ---------------------------------------------------------------------- Phil · 2018-03-28 18:18 Quote from: lainz on March 28, 2018, 08:15:48 pmThat'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/ ---------------------------------------------------------------------- wp · 2018-03-28 18:25 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. ---------------------------------------------------------------------- Phil · 2018-03-28 18:29 Quote from: wp on March 28, 2018, 08:25:14 pmthis 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). ---------------------------------------------------------------------- lainz · 2018-03-28 19:30 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. ---------------------------------------------------------------------- Phil · 2018-03-28 20:20 Quote from: lainz on March 28, 2018, 09:30:58 pmAbout 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#MiscNote s ---------------------------------------------------------------------- lainz · 2018-03-29 01:06 I'm using the cross platform way Lazarus provides for config and translations. But I don't know the exact details. How these work. ---------------------------------------------------------------------- Phil · 2018-03-29 01:25 Quote from: lainz on March 29, 2018, 03:06:39 amI'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/