Localizer - translate your apps easily - v0.6 (Lin/Mac/Win)

Developed or developing a new product in PureBasic? Tell the world about it.
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Localizer - translate your apps easily - v0.6 (Lin/Mac/Win)

Post by walker »

Hope, this is usefull for someone else. With this little tool you can replace nearly all strings used in your app with a variable and you'll get a file with all these replaced strings.... :D All your original files are left untouched(!) and you'll find, besides the file baselanguage.catalog, all altered files with a leading loc_...

simply choose the main source file... all used includes are searched and, if you have already a var which contains translations (i.E. the Language$ used by the VD of PB) it is searched too and the already used strings are added to the file.
REMARK: the datasection must have the label BaseLanguage

What's not working:
gtk-commands are not supported yet.. but maybe they'll work right out of the box (not tested yet)
you cannot exclude included files from translation (will be added) DONE
double entries are not eliminated (will be added)
no datasection is created.... (will be added... maybe)
commands within a command could cause a problem...

What you have to do:
if you already have a language var... comment all lines referring to this var and comment out the existing datasection as this one isn't needed any more
you have to read the languagefile (a routine is written in the main source at the top of the file)
if you want to run the altered files (leading loc_) you have to change the lines with the includes (i.e includefile "common.pb" to includefile "loc_common.pb") maybe I'll add this in a next version

translate the strings in another language :wink:

you can add or remove PB-Commands to be searched in the file commands.txt

if you use it for your apps, a credit somewhere in your app would be appreciated.. but is not a must

extract all files in a directory of your choice and start the app
choose a sourcefile (your main source)
if you have a variable already in use type in the name and check the checkbox
press Localize IT

An application with approx 25000 lines of code will be processed in approx 1-3 seconds .....

a screenshot:

Image

Download LInux-Version: http://home.arcor.de/x-linux/pure/localizer_lin.zip (~44kb)

Download Mac-Version: http://home.arcor.de/x-linux/pure/localizer_mac.zip (~56 kb)

Download Windows-Version: http://home.arcor.de/x-linux/pure/localizer_win.zip (~31kb)

The Mac-Version is maintained by michel51...

Error-reports, questions as well as other feedback is always welcome :D

enjoy

Update to 0.2:

- fixed a bug which prevets the app from running correctly when started from the gui (linux)
- fixed an issue if a variable is alredy used (sometimes not all used vars were found)

- added: now you can select the includefiles to be searched (be carefull with deselecting an include and you already use a variable...)
- added: the prefix "loc_" is now added to all sourcefiles (includes) which are used (i.e. Xinclude "common.pb" to Xinclude "loc_common.pb"

Update to 0.3:

- fixed: window size of include file chooser is now dynamical (michel51)
- added: About/Help
- added: Preferences
- updated: code is now 100% cross-plattform (Lin, Mac, Win)
- fixed: all temporary files are now created in users temp-directory
- fixed: handling of PB-commands improved
- fixed: some minoe bugs
- updated: GUI (same GUI on all 3 OS)

Updated to 0.6 (Windows only!; Linux and eventually Mac will follow)

Changed: code to search PB-Commands reworked (much smaller and faster)
Changed: the help is a bit more detailed now
Removed: check for double entries .. must be totally rewritten
Fixed : some minor bugs
NOT WORKING: changing the language (next version)

Download Windows-Version(0.6): http://home.arcor.de/x-linux/pure/localizer.zip (~24kb)
Last edited by walker on Wed Mar 11, 2009 2:33 pm, edited 6 times in total.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

Pretty cool program, I was thinking about making such a program too one time. Maybe I'll test your windows version when it's out.
I like logic, hence I dislike humans but love computers.
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Windows version is now available... :) download link see first post
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Interesting !
I was thinking of doing something like this to easily translate some of my apps.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

...that's the reason why I did it... :wink:
an update will be available soon (small bug fix and some improvements....)
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

walker wrote:...that's the reason why I did it... :wink:
an update will be available soon (small bug fix and some improvements....)
Hi walker,

what about a Mac version? Is it possible? Or are you using so much API-calls, that porting is not possibly?
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

actually not (as I don't own a MAC...) BUT when I'd finished my actual improvements...(will take some days).. Can I send you the source to build a mac version? 8)
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

walker wrote:.. Can I send you the source to build a mac version? 8)
Sure! That's a good idea. I will try to port to Mac. Hope there are not so much API-calls, because it's difficult sometimes to switch to Mac-version. Let's see. :)
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

..there are NO api calls in the windows-version (the linux one have some due to the commands I'd used to create the buttons with gfx..) anyway...

I'd updated both versions to 0.2 (added some functionality and removed some stupid bugs... and maybe added other bugs.. who knows..:wink: )
Changelog and download see first post
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

walker wrote:..there are NO api calls in the windows-version (the linux one have some due to the commands I'd used to create the buttons with gfx..) anyway...
Fine! Then porting to Mac will be easy :D
Changelog and download see first post

Done, but no source. If you want, you can send me the code (win) via pm.
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

done... update to v0.3 now includes a MAC-Version(!) which is maintained by michel51

Changelog and download see first post
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

very cool (3 OS) 8)

[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Hi,
I just tested localizer 0.3 [WinNT4].

Bugs
- Start Localizer, push '!' button, crash (Access violation), so I can't see the preferences.
- Some string parsing problems
Example :
Source wrote:MessageRequester("WARNING", "Sorry, here is a bug !", #MB_ICONEXCLAMATION)
Catalog wrote:Catalog
WARNING
Sorr
ere is a bug !
Suggestion for new features
(Maybe some of them can be set in Preferences ... ?)
1. Duplicate strings handling
2. Exclude some strings (black list)

Thanks.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

.... Access violation?... hmmm.. very strange.. I simply open a window... no API no special commands... I'll have a look

a "Blacklist" isn't necessary as the file Commands.txt contains all commands to be searched.. simply remove the one you don't want to parse... may I will include the enabling/disabling in the prefs....

the truncated strings... I guess i have a little thing to do... try to remove the colon in the string (the one after sorry) I guess it will solve the missing characters... I'll fix that in the next version

the duplicate string handling is not enabled because the function isn't ready to use yet...

I'll upload a new version this evening ....
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

walker wrote:a "Blacklist" isn't necessary as the file Commands.txt contains all commands to be searched.. simply remove the one you don't want to parse...
Not a blacklist for keywords, but for strings not to be translated, like '...' for example.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply