nxScribe - Multi language management application (ver 1.0.2)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

nxScribe - Multi language management application (ver 1.0.2)

Post by srod »

5th Feb 2008. Update - nxScribe version 1.0.2.
Small update - bugfix.

The generated code files were looking in the current directory for the language files rather than the program directory of the application being created. This could have led to problems, particularly if your application was being used as a PB IDE tool for example! (ahem! :oops: )

This has been fixed. It does mean, however, that when developing an application you should instruct Purebasic (via the IDE compiler options) to "Create temporary executable in the source directory" in order for the nxScribe generated code file to be able to locate your language files correctly at compile time. (Not a problem if using a default language file, but, otherwise... :) )

Download nxScribe 1.0.2

===============================================


18th Oct 2007. Update - nxScribe version 1.0.0.
This is the first full release as no more bugs have been reported for a while.

I did take the opportunity, however, to upgrade the UI by adding a nice explorer bar gadget. Makes things function a little smoother as well.
(The screenshot looks a little cluttered but that's only because of the image resizing etc. :) )

DOWNLOAD link is at the top of this thread.


Image




15th Oct 2007. Update - nxScribe version 1.0 beta 5.
Have added an optional parameter to the function LoadLanguageFile() which forms part of the include file generated by nxScribe and used by applications to load language files and retrieve individual language strings etc.

You can now specifiy the name of a language file (at run time) to use and which takes absolute priority over any language files specified when building the include file.

E.g. LoadLanguageFile("c:\English.lan") will load the relevant language file. Unlike the language files specified at the time nxScribe builds the include file, the file path can either be a relative or absolute path. Use LoadLanguageFile() as per beta 4 if you prefer to use the file(s) specified at build time etc.


DOWNLOAD link is at the top of this thread.


15th Oct 2007. Update - nxScribe version 1.0 beta 4.
Beta 4 sees the addition of code generation.

nxScribe will now produce a Purebasic source code file which your application uses (with XIncludeFile) to load your language file(s) and retrieve individual language strings.

It handles whetever format of language file you create (Purebasic preferences file, xml utf-8 format or xml utf-16 format) and gives you a choice of how your application is to retrieve it's language strings, namely :

1) through a function call : Language(group$, name$)
or 2) through the use of a global array : gLanguage$().

Option 1) is very flexible and uses a binary-chop to find the required language string etc. so is quite fast. If the required string is not found it just returns an empty string. You also only need to build this PB file once unless you wish to change some of the build options.

Option 2) is blisteringly fast, relying upon an enumerated list of constants which you use for the array indexes. However, this option requires that you rebuild the PB include file every time you make any kind of change to the structure of the underlying language files (else the array indexes could be out of bounds etc).

The choice is yours!

There are additional options such as the use of a default language file (which is packed into the application's executable and used if the application can find none of the specified language files) and these options do need a little care where file paths are concerned.
E.g. any default language file must be in the 'current directory' when the application is being built. At run time (after deployment) the language files are in a folder whose location is specified relative to the application installation folder etc.

Basically I need to get the help manual written! :)

When you have built the PB include file; just XIncludeFile into your application source, doing so very early on in the build. Right at the top of your source if possible.

Call the function : LoadLanguageFile() to load the appropriate language file(s). If this function returns zero then there was an error in trying to load the language file. In this case you would probably decide to terminate your application. It is therefore vitally important to check this return value.


DOWNLOAD link is at the top of this thread.


11th Oct 2007. Update - nxScribe version 1.0 beta 3.
A couple of bugs fixed.

Individual language files can now be saved in either PB preferences format, xml (utf-8 ) format or xml (utf-16) format.

REMOVED.

DOWNLOAD link is at the top of this thread.


10th Oct 2007. Update - nxScribe version 1.0 beta 2.
My thanks to all those who have tested out the first beta. Particular thanks to Gnozal and fangbeast for really going out of their way to help out.

Beta 2 sees the following alterations :
  • Individual language files can now be saved in Purebasic preferences format (as in beta 1) or XML (utf-8 ) format (new for beta 2). I've tested the resulting XML files with IE 6 and they seem well formed etc.
    Use XML format if you require trailing spaces with your language strings etc.
  • Individual language strings now retain their leading and trailing spaces (bug fix).
  • The toolbar icons no longer appear dithered (bug with the nxToolbar library which is now fixed). My thanks to fangbeast for this.
  • Grid columns are now resizeable.
  • Bugs with keyboard shortcuts fixed.
  • Added a button for adding rows to the grids used to edit language strings. You can still use the context menus however.
  • Fixed an issue causing nxScribe to crash out on Win NT. Still remains to be seen whether this new version will run on NT however? (Gnozal? :wink: )
  • Altered a few other things, but can't remember what they were now!
I've still to add the code generation and the help manual.

DOWNLOAD link is at the top of this thread.


Hi,

here's an easy to use tool which I've created as part of a much bigger project, but is really a stand alone product in it's own right.

nxScribe will allow you to easily create, manage and maintain multiple language files for your own multi-language applications. In fact with the code generation feature, users of this tool will really not have to worry about the various languages their application must support as nxScribe can handle the lot!

First a screenshot (why not!)

REMOVED.


As you can see from the screenshot, all language strings (English, French, Swahili, Zulu,... etc.) are kept together within a single 'project', making life much easier than would be the case when dealing with separate files for each language.

nxScribe will, when instructed, create separate language files for your application and for any selection of the languages defined within the project.
These individual language files so created are totally compatible with the multi-language management code posted by Freak in the following thread :
http://www.purebasic.fr/english/viewtop ... t=language

So, even if you don't take advantage of nxScribe's code generation feature, you can still use Freak's source code to interface your nxScribe generated language files with your application.

This is a beta version for those able to test this early version. As such, there is no help facility added as yet, and there remain a couple of things for me to add (the main one being the code generation! :wink: ) But it is otherwise fully functional and will create your language files quite happily.

I've released it now as it is a convenient time for me to seek some bug hunters!

The zip file contains the executable + the project file used to generate the language files used for nxScribe itself. Just run the program and open the project to get a feel for how it all works. Better still get nxScribe to generate the English language file from this project etc. (I've added a column to this project for French, hoping some kind French speaking person will fill in the gaps for me! :wink: Course, it'll have to be before the weekend's rugby world cup semi-final when we Brits show the world how not to play rugger!)

The executable requires Win 2000 onwards although, if there is a demand, I can compile a version which 'should' run on earlier versions of Windows.

Sorry about the lack of documentation, but I think the application is easy enough to figure out! :wink:

Whilst the kind hearted testers are busy ripping nxScribe apart I will be completing the code generation and then the user manual etc.

Regards.

DOWNLOAD link is at the top of this thread.
Last edited by srod on Tue Feb 05, 2008 12:39 pm, edited 11 times in total.
I may look like a mule, but I'm not a complete ass.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

hello sir hamsert hips

Post by Fangbeast »

I've been playing with your latest wizarding application, not a bad effort.

A few points to follow.

1. Some translation strings are going to be very long (textgadgets used as large labels) so the translation collumn needs to be resizeable. I'd suggest to move those arrow buttons up the top, make then entire embedded translation area larger and the second column resizeable.

2. Some strings require leading and trailing spaces and nxscribe does not save them. This needs to be done.

3. A flag to disable accidental sorting on the columns would be good. I enter translations as I have them entered in my forms, makes it easier to edit (for me) and I accidentally clicked on a column header (shudder) and lost my place.

4. An option to turn off tooltips. I know I put large, colourful tooltips in all of my applications (which is why yours and mine do not need help files!!!) but after a while, it annoys even me. You were right, the program is very easy to figure out.

5. Add the use of INSert and DELete keys for columns. Constant right click, select option from context menu hurts my wrists after a while. (hours of work actually)

Good program, easy to use, well laid out and good for people with diminished eyesight. Doesn't need a degree in rocket science to figure out or use. Anything else I might have said would be a purely personal request and has nothing whatsoever to do with a well made program.

Keep up the good work.

P.s. The black outline around some of the menu icons is a little jagged. Is that because they are resized on the fly rather than stock icons?
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Bug 1

Post by Fangbeast »

I highlight a line of text in the second column and press CONTROL + X to cut it and nxscribe exits without warning!!!
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Bugger, I added a keyboad shortcut for control X to exit the program - I will remove that, or at least check which gadget has the focus.

Some excellent points fangles, I will address them all. The 'space' issue seems to be something to do with xml as the project files are saved in this format. I'll have a look though.

The toolbar icons are not resized no - but I'll take a look.

Thanks.
I may look like a mule, but I'm not a complete ass.
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Nice! I quickly tried the sample code you pointed out & created English & Japanese content, and it worked well. Nice simple & straightforward app. Thanks alot. The string files created are UTF-8 (which of course makes sense for this app) - it's mildly curious to me that UTF-8 content is dealt with ok without any explicit need to convert from UTF-8 to UTF-16 (the latter I thought was the default format for PB strings when compiled as unicode). Anyway I digress..

As a suggestion on the 'create language files' window, you could put buttons between the 2 list-boxes like:
  • [>] use selected language (move from left to right) window
    [>>] use all
    [<] delete selected
    [<<] delete all (in right-hand window)
to make it really clear about the possible actions.

Also (a very minor polish point for the future) you probably don't need the ending period (.) in the title text e.g. in the above window.

Looking forward to working with this some more in the future. Thanks again.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

Bugger, I added a keyboad shortcut for control X to exit the program - I will remove that, or at least check which gadget has the focus.
No, no, no!! Control + X is almost an industry standard for the "CUT" function. It's usually ALT +X which is exit!!! I've been in the computer industry for over 28 years and Control + X has never been anything other than "CUT" in all of the applications that I have used.
Some excellent points fangles,
I try. You did say you "might" use me as a beta tester and you didn't so I volunteered/ 5 hours spent on this project.
The 'space' issue seems to be something to do with xml as the project files are saved in this format. I'll have a look though.
It would be a problem if you didn't as not all strings are monolithic, some actually have to have strings concatenated from real time functions and they may need the spaces on either side of them. You can always use a substitute character in the saved xml to represent leading and trailing spaces.

E.G "You have " + Str(NumFiles.l) + " Files".

So I need the spaces on the end of the first string and the beginning of the next string.
The toolbar icons are not resized no - but I'll take a look.
Not a big deal really, just an observation.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Help! The help button does nothing! :lol:

And is there any reason in particular for ignoring the user's default font and using your own huge one instead?

Apart from that, I'll try to use it, the idea seems good.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Hi mskuma,

thanks for having a look. :)

The generated language files are PB preference files which defaults to utf-8 when compiling in unicode. The main project files are xml files with utf-8 encoding. I thought about using unicode here but for some reason IE 6 would complain about the encoding line everytime I took a peek!

As for the 'create language files' window - I just prefer drag and drop! :wink: I did think about using such buttons, but drag/drop is so much nicer. Anyhow there is a button for deleting the highlighted languages from the right hand listicon.

Thanks again.

@fangles - I've fixed the space issue. Unsure what is going on with the icons, but I agree there seems to be a 'dithering' effect for some reason!
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Hi Trond,

thanks.

The huge font! :) All gui elements use either Tahoma (ysize = 11) or Tahoma (ysize 9). What can I say, I like Tahoma! :wink:
I may look like a mule, but I'm not a complete ass.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Hi srod,
surely a nice and handy tool, unfortunately it will not work for me (Win9x / NT4) ... and the image is blocked by the corporate firewall !
I have a current project like this, but far from finished. It only scans the source for unique strings for now. I was thinking about replacing automatically the strings in the source with a language array or procedure. Does your tool do something similar ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Hi,

the program is compiled for unicode so will not run on Win 98. Not sure about NT - is that a unicode OS?

I could compile a version for Win 98, but I'm unsure how this will effect matters because the generated language files will of course have to be in ascii and I'm unsure how xml encoding will be effected? If I do compile such a version and it doesn't run then I am afraid that I will not pursue the matter any further! :)

As for scanning source code - nxScribe will certainly generate a source code include file which can be used in your application for dealing with all language issues etc. Scanning source to create a project file... One for later on! :wink:
I may look like a mule, but I'm not a complete ass.
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Hi srod, I've come across a weird situation - not sure how it happened, but when I ran your program recently, all the text labels disappeared.. all the button text etc, all blank. I renamed the folder, and reunzipped it to a new folder & tried to reproduce it.. but to no avail (works fine).. the old folder with the original exe still does this behaviour. How I think I did it was I opened the nxScribeCreator.nxScribe file, browsed and then bailed out, and the next time I ran the app, I saw this behaviour.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

That will be an issue with the language file used by nxScribe itself.

nxScribe searches the current directory for files ending with .lan. If it finds one it assumes that it is the language file it is supposed to use. If it doesn't find one then it unpacks a default language file (English).

You must have saved a file in the program directory with a .lan extension. Just remove it and nxScribe will default back to it's English language file.

Don't save any language files in the nxScribe program directory! :wink:
I may look like a mule, but I'm not a complete ass.
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Yes you're right. Thanks. Sorry about that.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

srod wrote:the program is compiled for unicode so will not run on Win 98. Not sure about NT - is that a unicode OS?
Yes
I did not try though because of "The executable requires Win 2000 onwards".
srod wrote:I could compile a version for Win 98, but I'm unsure how this will effect matters because the generated language files will of course have to be in ascii and I'm unsure how xml encoding will be effected? If I do compile such a version and it doesn't run then I am afraid that I will not pursue the matter any further! :)
I don't know much about XML :oops:
srod wrote:As for scanning source code - nxScribe will certainly generate a source code include file which can be used in your application for dealing with all language issues etc. Scanning source to create a project file... One for later on! :wink:
Ok :wink:
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply