Skip to content

Commit

Permalink
Add back support for conditional strings in translations
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Oct 7, 2024
1 parent d88e750 commit 8352d5a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion Languages/English/ChatDisabled.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Greet
What's my name? [Name] What's my name? [Name] WHAT'S MY NAME!
Supposedly [RandomRace] really suck these days... guess we'll find out.
I think I know where [PlayerColor] started
{Race!=HUMAN} Thank god I'm not humans again. race_name[own_race] != quotemeta("HUMAN")
{!RaceChoiceRandom,Race=ORC,1on1} Orcs rule 1 on 1. My [Color] [Race] army is gonna own you.
{Name=Hunter}Let the hunt begin!
{Name=Crazy_Rusher} Rush, Rush, RUSH!!!
Expand Down
1 change: 1 addition & 0 deletions Languages/English/ChatGreet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Hello, warrior. I hope you brought your best skills and equipment.
Greetings, conqueror. You have come to claim your destiny.
Hello, legend. You have earned the right to face me in combat.
Greetings, friend. I'm just kidding. You are my enemy and I will crush you.
Thank god I'm not humans again. race_name[own_race] != HUMAN
12 changes: 4 additions & 8 deletions common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -3012,15 +3012,11 @@ function InitChatArrays%1 takes nothing returns nothing
#INCLUDETABLE <ChatEvents.txt> #EFR
#DEFINE $chatevent$ %1
set chat_$chatevent$_length = 0
#INCLUDETABLE <Languages\$lang$\Chat$chatevent$.txt> #ENC:$enc$ #COND "%2" ne ""
if %2 then
set chat_$chatevent$[#EVAL{%row-1}] = "%1"
set chat_$chatevent$_length = chat_$chatevent$_length + 1
endif
#ENDINCLUDE
#INCLUDETABLE <Languages\$lang$\Chat$chatevent$.txt> #ENC:$enc$ #COND "%2" eq ""
set chat_$chatevent$[#EVAL{%row-1}] = "%1"
#INCLUDETABLE <Languages\$lang$\Chat$chatevent$.txt> #ENC:$enc$
#EVAL{"%3" ? "if %2\"%3\" then" : ("%2" ? "if %2 then" : "")}
set chat_$chatevent$[chat_$chatevent$_length] = "%1"
set chat_$chatevent$_length = chat_$chatevent$_length + 1
#EVAL{("%2" or "%3") ? "endif" : ""}
#ENDINCLUDE
#ENDINCLUDE

Expand Down
6 changes: 4 additions & 2 deletions ejass.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/perl -w
use strict;

no warnings 'uninitialized'; # Complex language processing on InitChatArrays throws these and no way to avoid them in this case.

unless ( $ARGV[0] and $ARGV[0] !~ /-[h?]/ ) {
print "------------------------------------------------------\n";
print "|\n| Jass Pre-parser version 0.0.11\n";
Expand Down Expand Up @@ -68,7 +70,7 @@
$_ = fnamerep($_) unless /\#DEFINE/;
if (/^\/\//) {}
elsif (/#PRAGMA/) {}
elsif (/(#IFDEF) (\w+)/) {
elsif (/(#IFDEF) [\$]?(\w+)[\$]?/) {
#warn "IFDEF";
$level++;
$file[$level]{"if"} = $1;
Expand All @@ -80,7 +82,7 @@
$file[$level]{"skip"} = $skip;
$skip = (not $file[$level]{$file[$level]{"now"}} or $file[$level]{"skip"});
}
elsif (/(#IFNDEF) (\w+)/) {
elsif (/(#IFNDEF) [\$]?(\w+)[\$]?/) {
#warn "IFNDEF";
$level++;
$file[$level]{"if"} = $1;
Expand Down

0 comments on commit 8352d5a

Please sign in to comment.