Posted by: Wisp
« on: April 17, 2015, 11:38:40 AM »Does this mean there's no reason to include iconv in the Linux and OSX versions of a mod?Correct.
Does this mean there's no reason to include iconv in the Linux and OSX versions of a mod?Correct.
OS X and GNU/Linux come with iconv as part of the base system.Does this mean there's no reason to include iconv in the Linux and OSX versions of a mod?
I think I should be able to add a "default_language" variable, which could default to English. The default language would be converted regardless of which language the user chooses, so you would be able to use that for defensive loading of TRA-files. reload_array would also load reload the TRA files of the default language before reloading those of the user's language.This has now been coded. Those with a different default language than English can provide the default_language variable to HANDLE_CHARSETS. Others do not need to do anything and English TRA files will automatically be converted in addition to the TRA files of whatever language the user selects at the start of the installation (files will never be converted twice).
-Would it be possible to have the option to let HANDLE_CHARSETS convert e.g. two language versions (e.g. always English and the chosen one) including the possibility to load the files of two language versions? (Or maybe I am the only one wanting this?) EDIT: It would have to be the setup.tra and game.tra etc. only, anyway.You are quite right in reporting this. Thank you. I think I should be able to add a "default_language" variable, which could default to English. The default language would be converted regardless of which language the user chooses, so you would be able to use that for defensive loading of TRA-files. reload_array would also load reload the TRA files of the default language before reloading those of the user's language.
I noticed the version included in WeiDU 237 behaves differently than the version previously available as en external file. In the past, only the language selected was converted to UTF-8. The version included in WeiDU 237 seems to convert the tra files for all languages available.Thanks for spotting it. The recursive behaviour is over ~%tra_path%~ rather than ~%tra_path%/%LANGUAGE%~. It's harmless, but as you say, quite wasteful. However, I also found a more serious bug. HANDLE_CHARSETS in 237 converts files even if they are present in noconvert_array, which can cause problems (up to and including mods that can't be uninstalled without manual intervention. Fortunately they merely can't be uninstalled; it's not a game-hosing deal where mods would be removed from the log without actually being uninstalled).
I noticed this while updating BG1 NPC to use HANDLE_CHARSETS. The conversion took a long time on my PC, more than a minute. That triggered to check what was going on. I checked with another mod, Tiax, and WeiDU also converted files for all three available languages.
The backup of the original files is neatly organised, the language name being inserted in the file name, except for english (maybe because it's the first LANGUAGE statement). That makes me wonder if this behaviour is actually intented. Could you tell us the intended behaviour, please, Wisp ? Thank you.
Mike1072 suggested a way to reduce the size of the iconv contribution to the archive in this topic.Ok.
I'm wondering if REPLACE_TEXTUALLY will work with a variable in the "to" text though.It will. You just SPRINT the traref into a variable as an intermediate step (because REPLACE_TEXTUALLY does not take trarefs as either oldtext or newtext).
As an alternative to using regexp, is it possible to use two HANDLE_CHARSETS calls with a different extension each time ?Easy for me and extra work for others. I like it.