Author Topic: Does GetName() honor localized strings?  (Read 544 times)

Legacy_lovellin

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Does GetName() honor localized strings?
« on: June 03, 2012, 02:27:33 pm »


               While building an German-language module, I encountered an issue with GetName(). The function doesn't seem to return localized strings, but always the English version.

I tested with following settings:
Language ID of dialog.tlk, dialogF.tlk and my custom TLK is German.
The test objects, a door and a placeable, have been created from scratch by the toolset wizard. I entered an English, a French and a German version in the name field.
According to gffeditor, the name field then contains a CExoLocString where strref = -1 and the 3 versions are embedded with their language ID.
In the game, the German version is displayed as expected. GetName(), however, returns the English version.

This oddity means an obstacle to create scripted console messages about game objects, e.g. "{name} does this or that". Is this a known issue? Who has experience with this. Did I perhaps miss a further language configuration hidden somewhere?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #1 on: June 03, 2012, 03:02:13 pm »


               You sure that NWN installed on server machine has german dialog.tlk?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #2 on: June 03, 2012, 05:10:59 pm »


               I only have an english version of the game so it is hard for me to test anything dealing with this.
I have some questions however.

Questions:

1) Is this a single player game. Or a multiplayer game, Including a singleplayer game ran via the standalone server?

2) Are you using the TRUE Paramater for bOriginalName.

Thoughts.
The String returned by the GetName Function is a CExoString not a CExoLocString. This neans that in a multi player Envirment only one language can be returned by the function reguardless. If you are trying to do this on a server, The version returned should be the same as the version of the server. As far as I know they have only made an English version of the stand alone server.

If you are using GetName in a multiplayer game. It will never be able to handle multi-language-Clients. It will simply retrive the name from the servers version and pass it on.

This is just the problem you are running into if the function is working for getting the correct channel.

Reguardless, In order for multi-language support in a single instance of a game, The only supported system seems to be the use of the tokens. You could experment with using <FullName> though I do not know if it will work where you are trying to use it at, or not.
               
               

               


                     Modifié par Lightfoot8, 03 juin 2012 - 04:14 .
                     
                  


            

Legacy_lovellin

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #3 on: June 03, 2012, 07:10:01 pm »


               Thank you for your prompt reply.
As I wrote above, dialog.tlk, dialogF.tlk and my custom.tlk are all configured with language ID "German". I looked up the value in Axe Murderers Killer TLK editor.
bOriginalName is FALSE (the default). The name has not been altered by SetName(); the test objects have simply been placed in the area in the toolset.
This is a single-player module that has been started immediately from the client.
I'm just checking the .ini files. It seems that some registry entries are missing that are indicated in nwnconfig.ini group [Registry]. I'm going to investigate this issue further.
               
               

               
            

Legacy_lovellin

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #4 on: June 03, 2012, 07:23:26 pm »


               It seems that the installer didn't set the registry entries in Windows 7. I'd like to add them by hand. The values are supposedly those in nwnconfig.ini, but I don't know the data types. In order to achieve a regular installation, would anyone look up the registry keys in HKEY_LOCAL_MACHINE\\SOFTWARE\\Bioware\\NWN\\Neverwinter?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #5 on: June 03, 2012, 08:02:47 pm »


               

lovellin wrote...

bOriginalName is FALSE (the default). The name has not been altered by SetName(); the test objects have simply been placed in the area in the toolset.


Correct,  You will want to set it to TRUE, To have any chance of getting the language version.  SetName was added in the 1.69 update. It was also an english only update if memory serves me correctly.  So setting the value to TRUE will give you a chance of reverting back to the original functions.


lovellin wrote...

It seems that the installer didn't set the registry entries in Windows 7. I'd like to add them by hand. The values are supposedly those in nwnconfig.ini, but I don't know the data types. In order to achieve a regular installation, would anyone look up the registry keys in HKEY_LOCAL_MACHINESOFTWAREBiowareNWNNeverwinter?


I have not had any regestry entrys for NWN in a verry long time.  My understanding on them is that they are only needed for  the patches to be able to find the correct directories.    But then again I am running an english version and you may have just found a Place where we did not know they where used.

EDIT:  I guess I still do have some. 
Note:  Your GUID will be differant and of cource you will need to change the language channel.  0 is english.


'Image
               
               

               


                     Modifié par Lightfoot8, 03 juin 2012 - 07:14 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #6 on: June 03, 2012, 08:25:24 pm »


               
Extra Information for Language ID's   Copied from the file format.


2. Embedded Strings with Language IDs

If the StrRef is invalid (ie., 0xFFFFFFFF), then the talk table is not used, and instead, the localized
text must be embedded within the CExoLocString. A CExoLocString may contain zero or more
embedded strings, each paired with a language ID that identifies what language the string should
be displayed for. The talk table file itself stores the user's language ID.
The following is a list of languages and their IDs:

Table 2: Language IDs
Language ID

English 0
French 1
German 2
Italian 3
Spanish 4
Polish 5
Korean 128
Chinese Traditional 129
Chinese Simplified 130
Japanese 131

3. Gender

In addition to specifying a string by Language ID, substrings in a LocString have a gender
associated with them. 0 = neutral or masculine; 1 = feminine. In some languages, the text that
should appear would vary depending on the gender of the player character, and this flag allows the
application to choose an appropriate string.
BioWare Corp.
http://www.bioware.com

4. LanguageID and Gender combination

Internally, LocStrings store LanguageID and Gender as single combined ID that is equal to double
the LanguageID, plus 0 for male strings and 1 for female strings. This is the same format in which
LocStrings are saved out (refer to the Generic File Format document, section 4.6).
               
               

               
            

Legacy_lovellin

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #7 on: June 03, 2012, 08:25:51 pm »


               Using bOriginal=TRUE won't fix the problem.
A third test object, which has a German name only, is handled correctly.
This issue is not a showstopper for me, because I'm currently working on a test module intended only for script development. I'll check whether ConvertLangID.exe can eliminate strings that get in the way. If that works, I could treat the actual game as follows:
- keep all translations in a "master" module
- before release, create a copy for each supported language and clean them up with ConvertLangID.exe.
Do you think that could work?
               
               

               


                     Modifié par lovellin, 03 juin 2012 - 07:33 .
                     
                  


            

Legacy_lovellin

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #8 on: June 03, 2012, 08:33:29 pm »


               Language Setting in the Registry doesn't seem to matter.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #9 on: June 04, 2012, 12:58:42 am »


               I have no Ide what ConvertLangID.exe is.
Perhaps Shadow will have an Idea,  He has worked more with the language thing then I have.   
Perhaps a Mass leto Edit would be able to make the adjustment you want.

Funkys thread may help with that.  How to Mass Edit and Data Mine your Module
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #10 on: June 04, 2012, 09:19:30 am »


               Actually I don't, Ive looked into it in past but never understood point of it. Seems that OP is right and there is a bug in function, afterall the function getname is missing the nLang parameter. Im working on foreign language myself however this language is not official and original translators simply translated english dialog.tlk so its basically impossible now to make a multi czech+english server now as I can not use localized entries in toolset.
               
               

               
            

Legacy_lovellin

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #11 on: June 04, 2012, 08:12:20 pm »


               ConvertLangID.exe can be found in the NWN utils directory. It serves to move or copy embedded strings in a CExoLocString from one language ID to another. It doesn't support deleting entries of a certain language ID, so I had to take a workaround: I moved German texts to English ID, overwirting existing entries. Then I moved all entries back to German ID. Now, the module contains the German texts in German ID, but the English strings have all been eliminated and don't go into the way. During testing, GetName() now correctly picked the German text, as previous language IDs in search order are empty.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Does GetName() honor localized strings?
« Reply #12 on: June 04, 2012, 09:08:28 pm »


               

lovellin wrote...

ConvertLangID.exe can be found in the NWN utils directory.



Interesting,  It does not come with the English version of the game.  At least It did not come with my version.