Skip to content

Commit

Permalink
TTDz v1.2.4 - fix translations (for real this time?)
Browse files Browse the repository at this point in the history
  • Loading branch information
agb1 committed Dec 8, 2016
1 parent ccbd9ac commit cc3e21c
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 77 deletions.
1 change: 0 additions & 1 deletion TDDz/Lib/Helpers.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ DEFINE_ACTION_FUNCTION DeleteTempFolder
BEGIN
LAM ForceClearTempFolder
LAF REMOVE_DIRECTORY STR_VAR dir_name = EVAL ~%MOD_FOLDER%/TEMP/_%aComp%~ END
LAF REMOVE_DIRECTORY STR_VAR dir_name = EVAL ~%MOD_FOLDER%/TEMP/Translations/iconv~ END
LAF REMOVE_DIRECTORY STR_VAR dir_name = EVAL ~%MOD_FOLDER%/TEMP/Translations~ END
LAF REMOVE_DIRECTORY STR_VAR dir_name = EVAL ~%MOD_FOLDER%/TEMP~ END
END
Expand Down
61 changes: 33 additions & 28 deletions TDDz/Lib/Importer.tpa
Original file line number Diff line number Diff line change
@@ -1,50 +1,62 @@
OUTER_TEXT_SPRINT COMP_FOLDER ~~

//=============================================================================
DEFINE_ACTION_MACRO GetComponentFolders
DEFINE_ACTION_MACRO FetchTranslationsBeforeAnySAYandCOMPILE
BEGIN
GET_DIRECTORY_ARRAY componentFolders ~%MOD_FOLDER%/%COMP_FOLDER%~ ~.*~
ACTION_PHP_EACH componentFolders AS folderName => folderPath BEGIN
OUTER_SPRINT $FOLDER_EXISTS("%folderPath%") ~%folderPath%~
//PRINT ~%FOLDER_EXISTS_folderPath%~
PRINT ~1~
ACTION_IF DIRECTORY_EXISTS "%MOD_FOLDER%/%COMP_FOLDER%/TRA" BEGIN
PRINT ~abc~
COPY ~%MOD_FOLDER%/%COMP_FOLDER%/TRA/%LANGUAGE%~ ~%MOD_FOLDER%/TEMP/Translations~
PRINT ~def~
LAF HANDLE_CHARSETS // convert tra files to UTF-8 encoding if needed
INT_VAR
infer_charsets = 1
STR_VAR
language = ~~
tra_path = EVAL ~%MOD_FOLDER%/TEMP/Translations~
iconv_path = EVAL ~%MOD_FOLDER%/tools/iconv/win32~
END
PRINT ~2~
END
PRINT ~3~
END


//=============================================================================
DEFINE_ACTION_FUNCTION ImportComponent STR_VAR aComp = ~~
BEGIN
BEGIN
OUTER_TEXT_SPRINT COMP_FOLDER ~_%aComp%~

MKDIR ~%MOD_FOLDER%/Audio~
MKDIR ~%MOD_FOLDER%/tiz~
MKDIR ~%MOD_FOLDER%/TEMP~
MKDIR ~%MOD_FOLDER%/TEMP/Translations~
MKDIR ~%MOD_FOLDER%/TEMP/%COMP_FOLDER%/~
LAM GetComponentFolders


MKDIR ~%MOD_FOLDER%/TEMP/Translations~
MKDIR ~%MOD_FOLDER%/TEMP/%COMP_FOLDER%~

PRINT ~%aComp%~
LAM FetchTranslationsBeforeAnySAYandCOMPILE
INCLUDE ~%MOD_FOLDER%/Lib/Translations.tpa~ LAM UTF8Chores
PRINT ~%aComp%~

//LAM ImportSPL_FromTDD
LAM ImportCRE_FromTDD
LAM ImportITM_FromTDD
LAM ImportSTO_FromTDD
LAM ImportARE_FromTDD

ACTION_DEFINE_ASSOCIATIVE_ARRAY dispatch BEGIN
BAM => override
BMP => override
ITM => override
PRINT ~%aComp%~

ACTION_DEFINE_ASSOCIATIVE_ARRAY dispatch BEGIN
BAM => override
BMP => override
ITM => override
STO => override
MOS => override
BAF => ~%MOD_FOLDER%/TEMP/%COMP_FOLDER%~
D => ~%MOD_FOLDER%/TEMP/%COMP_FOLDER%~
D => ~%MOD_FOLDER%/TEMP/%COMP_FOLDER%~
END
ACTION_PHP_EACH dispatch AS restype => to BEGIN
ACTION_IF VARIABLE_IS_SET $FOLDER_EXISTS("%MOD_FOLDER%/%COMP_FOLDER%/%restype%")
ACTION_IF DIRECTORY_EXISTS "%MOD_FOLDER%/%COMP_FOLDER%/%restype%"
BEGIN COPY ~%MOD_FOLDER%/%COMP_FOLDER%/%restype%~ ~%to%~ END END

LAM ApplyScriptedXpCustomization
LAF InstallComponentSpecificContents STR_VAR comp = EVAL ~%aComp%~ END
LAM CompileBAFandDAfterCustomizationsApplied
Expand Down Expand Up @@ -287,13 +299,6 @@ BEGIN
END


//=============================================================================
DEFINE_ACTION_MACRO FetchTranslationsBeforeAnySAYandCOMPILE
BEGIN
ACTION_IF VARIABLE_IS_SET $FOLDER_EXISTS("%MOD_FOLDER%/%COMP_FOLDER%/TRA")
BEGIN COPY ~%MOD_FOLDER%/%COMP_FOLDER%/TRA/%LANGUAGE%~ ~%MOD_FOLDER%/TEMP/Translations~ END
END

//=============================================================================
DEFINE_ACTION_MACRO HandleAudio
BEGIN
Expand Down
45 changes: 13 additions & 32 deletions TDDz/Lib/Translations.tpa
Original file line number Diff line number Diff line change
@@ -1,52 +1,33 @@
//=============================================================================
/* USED DURING INITIAL DEVELOPMENT - NOT USED NOW
DEFINE_ACTION_MACRO DispatchTraFiles //copy translation files into their component folder based on English folder
BEGIN
ACTION_FOR_EACH comp IN ~_Espurta~ ~_Purskal~ ~_Trollford~ ~_Riatavin~ ~_ROBILARD~ BEGIN
ACTION_BASH_FOR ~%MOD_FOLDER%/%comp%/TRA/English/~ ~.*\.tra~ BEGIN
ACTION_FOR_EACH comp IN ~_Espurta~ ~_Purskal~ ~_Trollford~ ~_Riatavin~ ~_Robilard~ BEGIN
ACTION_BASH_FOR ~%MOD_FOLDER%/%comp%/TRA/English/~ ~.*\.tra~ BEGIN
ACTION_FOR_EACH language IN ~French~ ~German~ ~Italian~ ~Polish~ ~Russian~ ~Spanish~ BEGIN
COPY ~TDD/Language/%language%/%BASH_FOR_FILE%~ ~%MOD_FOLDER%/%comp%/TRA/%language%/%BASH_FOR_FILE%~
COPY ~TDD/Language/%language%/%BASH_FOR_FILE%~ ~%MOD_FOLDER%/%comp%/TRA/%language%/%BASH_FOR_FILE%~
END
END
END
END
END*/

//=============================================================================
DEFINE_ACTION_MACRO UTF8Chores // Borrowed from WhiteQueen then customized
DEFINE_ACTION_MACRO UTF8Chores
BEGIN
MKDIR ~%MOD_FOLDER%/TEMP/Translations/iconv~

ACTION_MATCH ~%WEIDU_OS%~ WITH
win32
BEGIN
COPY ~%MOD_FOLDER%/tools/iconv/win32/iconv.exe~ ~%MOD_FOLDER%/TEMP/Translations/iconv/iconv.exe~
COPY ~%MOD_FOLDER%/tools/iconv/win32/libiconv2.dll~ ~%MOD_FOLDER%/TEMP/Translations/iconv/libiconv2.dll~
COPY ~%MOD_FOLDER%/tools/iconv/win32/libintl3.dll~ ~%MOD_FOLDER%/TEMP/Translations/iconv/libintl3.dll~
END
osx unix
BEGIN
// TODO
END
DEFAULT
END
// any tra files used in LANGUAGE need to be reloaded after UTF-8 conversion
ACTION_DEFINE_ARRAY tra#reload BEGIN END

INCLUDE ~%MOD_FOLDER%/Lib/handle_charsets.tpa~

// No exception, everything needs to be converted
ACTION_DEFINE_ARRAY WQxnoconvert BEGIN END

// Only legacy setup.tra and tp2.tra needs to be reloaded
ACTION_DEFINE_ARRAY WQxreload BEGIN setup tp2 END
ACTION_DEFINE_ARRAY tra#noconvert BEGIN END

// There is no "language" folder so the root of all languages in %MOD_FOLDER%
LAF HANDLE_CHARSETS
INT_VAR
infer_charset = 1
infer_charsets = 1
STR_VAR
tra_path = EVAL ~%MOD_FOLDER%/TEMP/Translations~
// charset_table = WQxcharsets // Included for illustrative purposes.
noconvert_array = WQxnoconvert
reload_array = WQxreload
iconv_path = EVAL ~%MOD_FOLDER%/tools/iconv/win32~
reload_array = tra#reload
noconvert_array = tra#noconvert
END

END

28 changes: 15 additions & 13 deletions TDDz/Setup-TDDz.tp2
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
BACKUP ~TDDz/Backup~
AUTHOR ~shadowlich~
VERSION ~v1.2~
VERSION ~v1.2.4~

ALWAYS
INCLUDE ~%MOD_FOLDER%/Lib/Helpers.tpa~
INCLUDE ~%MOD_FOLDER%/Lib/Helpers.tpa~
LAM ForceClearTempFolder

INCLUDE ~%MOD_FOLDER%/Lib/a7_tools.tpa~
INCLUDE ~%MOD_FOLDER%/Lib/a7_tools.tpa~

ACTION_IF GAME_IS ~eet~ BEGIN
OUTER_SET bg2_chapter = 12
END ELSE BEGIN
OUTER_SET bg2_chapter = 0
END
OUTER_FOR (i=1; i<=10; i=i+1) BEGIN
OUTER_FOR (i=1; i<=10; i=i+1) BEGIN
OUTER_SET bg2_chapter = bg2_chapter + 1
OUTER_SPRINT name_source ~bg2_chapter_%i%~
OUTER_SET EVAL ~%name_source%~ = bg2_chapter
END

// any tra files used in LANGUAGE need to be reloaded after UTF-8 conversion
ACTION_DEFINE_ARRAY tra#reload BEGIN tp2 setup END

Expand All @@ -29,6 +30,7 @@ ALWAYS
infer_charsets = 1
STR_VAR
tra_path = EVAL ~%MOD_FOLDER%/Translations~
iconv_path = EVAL ~%MOD_FOLDER%/tools/iconv/win32~
reload_array = tra#reload
noconvert_array = tra#noconvert
END
Expand All @@ -41,7 +43,7 @@ AUTO_TRA ~TDDz/TEMP/Translations~
LANGUAGE ~English~
~English~
~TDDz/Translations/English/Tp2.tra~
~TDDz/Translations/English/Setup.tra~
~TDDz/Translations/English/Setup.tra~

LANGUAGE ~Russian(aerie-ru)~
~Russian~
Expand All @@ -56,7 +58,7 @@ LANGUAGE ~Polish(by SoM, part of CoB Clan, in co-operation with TB Team)~
LANGUAGE ~German(Leonardo Watson)~
~German~
~TDDz/Translations/German/setup.tra~
~TDDz/Translations/German/tp2.tra~
~TDDz/Translations/German/tp2.tra~

LANGUAGE ~Francais(Isaya)~
~French~
Expand All @@ -74,7 +76,7 @@ LANGUAGE ~Spanish(Clan REO)~
~TDDz/Translations/Spanish/tp2.tra~

// TODO: TTPOT.itm has weird name in vanilla BG2EE...is it normal???


// Notes:
// - INITDLG.d @override!
Expand All @@ -87,7 +89,7 @@ LANGUAGE ~Spanish(Clan REO)~


BEGIN @901000
REQUIRE_PREDICATE GAME_IS ~tob bg2ee eet~ ~~
REQUIRE_PREDICATE GAME_IS ~tob bg2ee eet~ ~~

INCLUDE ~%MOD_FOLDER%/Lib/Importer.tpa~
LAF ImportComponent STR_VAR aComp = ~CORE~ END
Expand All @@ -113,7 +115,7 @@ BEGIN @901002
LAF DeleteTempFolder STR_VAR aComp = ~ESPURTA~ END

BEGIN @901003
REQUIRE_PREDICATE GAME_IS ~tob bg2ee eet~ ~~
REQUIRE_PREDICATE GAME_IS ~tob bg2ee eet~ ~~
REQUIRE_COMPONENT "setup-TDDz.tp2" "0" @901011

INCLUDE ~%MOD_FOLDER%/Lib/Importer.tpa~
Expand All @@ -122,7 +124,7 @@ BEGIN @901003
LAF DeleteTempFolder STR_VAR aComp = ~PURSKAL~ END

BEGIN @901004
REQUIRE_PREDICATE GAME_IS ~tob bg2ee eet~ ~~
REQUIRE_PREDICATE GAME_IS ~tob bg2ee eet~ ~~
REQUIRE_COMPONENT "setup-TDDz.tp2" "0" @901011

INCLUDE ~%MOD_FOLDER%/Lib/Importer.tpa~
Expand All @@ -131,7 +133,7 @@ BEGIN @901004
LAF DeleteTempFolder STR_VAR aComp = ~RIATAVIN~ END

BEGIN @901005
REQUIRE_PREDICATE GAME_IS ~tob bg2ee eet~ ~~
REQUIRE_PREDICATE GAME_IS ~tob bg2ee eet~ ~~
REQUIRE_COMPONENT "setup-TDDz.tp2" "0" @901011

INCLUDE ~%MOD_FOLDER%/Lib/Importer.tpa~
Expand All @@ -154,4 +156,4 @@ BEGIN @901010
// DESIGNATED 99
// INCLUDE ~%MOD_FOLDER%/Lib/Translations.tpa~
// LAM DispatchTraFiles

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed TDDz/Translations/iconv/iconv.exe
Binary file not shown.
Binary file removed TDDz/Translations/iconv/libcharset1.dll
Binary file not shown.
Binary file removed TDDz/Translations/iconv/libiconv2.dll
Binary file not shown.
Binary file removed TDDz/Translations/iconv/libintl3.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions TDDz/Worldmap/Worldmap.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ BEGIN
END

COPY ~Worldmap/map_mods_trans.tra~ ~Worldmap~
APPEND_FILE_EVALUATE ~%MOD_FOLDER%/Worldmap/%LANGUAGE%/worldmap.tra~
APPEND_FILE_EVALUATE ~%MOD_FOLDER%/Translations/%LANGUAGE%/worldmap.tra~
END
ELSE BEGIN
MKDIR ~Worldmap~
COPY ~%MOD_FOLDER%/Worldmap/areas.tbl~ ~Worldmap/map_mods_areas.tbl~
COPY ~%MOD_FOLDER%/Worldmap/links.tbl~ ~Worldmap/map_mods_links.tbl~
COPY ~%MOD_FOLDER%/Worldmap/%LANGUAGE%/worldmap.tra~ ~Worldmap/map_mods_trans.tra~
COPY ~%MOD_FOLDER%/Translations/%LANGUAGE%/worldmap.tra~ ~Worldmap/map_mods_trans.tra~
END

//EET Worldmap
Expand All @@ -43,7 +43,7 @@ BEGIN
SPRINT EVAL ~%var%~ ~~
END ELSE BEGIN
INNER_ACTION BEGIN
COPY - ~TDDz/Worldmap/%LANGUAGE%/worldmap.tra~ ~.../TDDz/Worldmap/%LANGUAGE%~
COPY - ~TDDz/Translations/%LANGUAGE%/worldmap.tra~ ~.../TDDz-inlined/worldmap.tra~
REPLACE_EVALUATE CASE_INSENSITIVE ~~~~~^\([ %TAB%]*%match%[ %TAB%]*=[ %TAB%]*[~"]\)\([^~^"]+\)\([~"]\)~~~~~ BEGIN
INNER_PATCH_SAVE string "%MATCH2%" BEGIN
REPLACE_TEXTUALLY "###" " "
Expand Down
Binary file removed TDDz/tools/iconv/win32/libiconv-1.9.2-1-src.7z
Binary file not shown.

0 comments on commit cc3e21c

Please sign in to comment.