Skip to content

Commit

Permalink
Изменил формат для функции перевода: расширено количество подстановок…
Browse files Browse the repository at this point in the history
… до двух по предустановленным ключам
  • Loading branch information
13Hz committed Sep 20, 2023
1 parent 47ce26c commit 3639241
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 103 deletions.
64 changes: 32 additions & 32 deletions Crimes.bb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Menus.bb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ While go=0
SetFont font(1)
x=400 : y=120 : spacer=53
DrawOption(1,rX#(400),rY#(y),translate("Resolution"),textResX$(optRes)+" x "+textResY$(optRes)) : y=y+spacer
DrawOption(2,rX#(400),rY#(y),translate("Population"),translate("#COUNT# characters", "#COUNT#", str optPopulation)) : y=y+(spacer+5)
DrawOption(2,rX#(400),rY#(y),translate("Population"),translate("#FIRST# characters", str optPopulation)) : y=y+(spacer+5)
DrawOption(3,rX#(400),rY#(y),translate("Fog Effect"),textOnOff$(optFog)) : y=y+spacer
DrawOption(4,rX#(400),rY#(y),translate("Shadows"),textShadows$(optShadows)) : y=y+spacer
DrawOption(5,rX#(400),rY#(y),translate("Particle FX"),textFX$(optFX)) : y=y+spacer
Expand Down
2 changes: 1 addition & 1 deletion Players.bb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Function LoadPlayers()
For cyc=1 To no_plays
;generate model
Loader(translate("Please Wait"), translate("Loading Character #NUMBER# of ", "#NUMBER#", cyc) + no_plays)
Loader(translate("Please Wait"), translate("Loading Character #FIRST# of #SECOND#", cyc, no_plays))
p(cyc)=LoadAnimMesh("Characters/Models/Model"+Dig$(charModel(pChar(cyc)),10)+".3ds")
LoadSequences(cyc)
;appearance
Expand Down
8 changes: 4 additions & 4 deletions Values.bb
Original file line number Diff line number Diff line change
Expand Up @@ -600,19 +600,19 @@ Function LoadTextures()
tHair(count)=LoadTexture("Characters/Hair/Hair"+Dig$(count,10)+".png",4)
Next
For count=1 To no_faces
Loader(translate("Please Wait"),translate("Loading Face #NUMBER# of ", "#NUMBER#", Dig$(count,10))+no_faces)
Loader(translate("Please Wait"),translate("Loading Face #FIRST# of #SECOND#", Dig$(count,10), no_faces))
tFace(count)=LoadTexture("Characters/Faces/Face"+Dig$(count,10)+".JPG")
Next
For count=1 To no_bodies
Loader(translate("Please Wait"),translate("Loading Body #NUMBER# of ", "#NUMBER#", Dig$(count,10))+no_bodies)
Loader(translate("Please Wait"),translate("Loading Body #FIRST# of #SECOND#", Dig$(count,10), no_bodies))
tBody(count)=LoadTexture("Characters/Bodies/Body"+Dig$(count,10)+".JPG")
Next
For count=1 To no_arms
Loader(translate("Please Wait"),translate("Loading Arm #NUMBER# of ", "#NUMBER#", Dig$(count,10))+no_arms)
Loader(translate("Please Wait"),translate("Loading Arm #FIRST# of #SECOND#", Dig$(count,10), no_arms))
tArm(count)=LoadTexture("Characters/Arms/Arm"+Dig$(count,10)+".JPG")
Next
For count=1 To no_legs
Loader(translate("Please Wait"),translate("Loading Body #NUMBER# of ", "#NUMBER#", Dig$(count,10))+no_legs)
Loader(translate("Please Wait"),translate("Loading Body #FIRST# of #SECOND#", Dig$(count,10), no_legs))
tLegs(count)=LoadTexture("Characters/Legs/Legs"+Dig$(count,10)+".JPG")
Next
;racial shades
Expand Down
35 changes: 20 additions & 15 deletions translate_plugin/Translate.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,29 @@

Include "translate_plugin/Main.bb"

; Функция замены подстрок, всего 2 ключа для замены в тексте #FIRST# и #SECOND#
; string - исходная строка
; first - строка для замены ключа #FIRST#
; second - строка для замены ключа #SECOND#
; Возвращает строку с произведенными заменами, можно указать как два аргумента так и только один
Function replacement$(string$, firstReplace$ = "", secondReplace$ = "")
If Len(firstReplace$) > 0 Then
string$ = Replace$(string$, "#FIRST#", firstReplace$)
EndIf
If Len(secondReplace$) > 0 Then
string$ = Replace$(string$, "#SECOND#", secondReplace$)
EndIf
Return string$
End Function

; Функция для перевода строк
; title - строка, по которой производится поиск (в данном случае - оригинальная строка)
; needle - искомое выражение для замены
; replacement - заменяемая строка
; first - строка для подстановки в ключ #FIRST#
; second - строка для подстановки в ключ #SECOND#
; Возвращает переведенную или оригинальную строку
Function translate$(title$, needle$ = "", replacement$ = "")
Function translate$(title$, firstReplace$ = "", secondReplace$ = "")
For i = 0 To messagesCount
If title$ = messages$(i, 0) Then
If Len(needle$) > 0 and Len(replacement$) > 0 Then
Return Replace$(messages$(i, 1), needle$, replacement$)
Else
Return messages$(i, 1)
EndIf
EndIf
If title$ = messages$(i, 0) Then Return replacement$(messages$(i, 1), firstReplace$, secondReplace$)
Next
If Len(needle$) > 0 and Len(replacement$) > 0 Then
Return Replace$(title$, needle$, replacement$)
Else
Return title$
EndIf
Return replacement$(title$, firstReplace$, secondReplace$)
End Function
76 changes: 38 additions & 38 deletions translate_plugin/lang/Crimes.bb
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,23 @@ messages$(392, 1) = "!
messages$(393, 0) = "! You're under"
messages$(393, 1) = "! Òû ïîä"

messages$(394, 0) = "#COUNT# days in Southtown Correctional Facility!"
messages$(394, 1) = "#COUNT# äíÿì â èñïðàâèòåëüíîì ó÷ðåæäåíèè Ñàóòòàóíà!"
messages$(394, 0) = "#FIRST# and heard your defence..."
messages$(394, 1) = "#FIRST# è âûñëóøàë îïðàâäàíèÿ..."

messages$(395, 0) = "#CRIME# and heard your defence..."
messages$(395, 1) = "#CRIME# è âûñëóøàë îïðàâäàíèÿ..."
messages$(395, 0) = "#FIRST# days in Southtown Correctional Facility!"
messages$(395, 1) = "#FIRST# äíÿì â èñïðàâèòåëüíîì ó÷ðåæäåíèè Ñàóòòàóíà!"

messages$(396, 0) = "#NAME# seems to have a problem with authority!"
messages$(396, 1) = "Ó #NAME# ïîõîæå, ïðîáëåìû ñ çàêîíîì!"
messages$(396, 0) = "#FIRST# seems to have a problem with authority!"
messages$(396, 1) = "Ó #FIRST# ïîõîæå, ïðîáëåìû ñ çàêîíîì!"

messages$(397, 0) = "#NAME# was caught out of his cell during"
messages$(397, 1) = "#NAME# áûë ïîéìàí âíå êàìåðû âî âðåìÿ"
messages$(397, 0) = "#FIRST# was caught out of his cell during"
messages$(397, 1) = "#FIRST# áûë ïîéìàí âíå êàìåðû âî âðåìÿ"

messages$(398, 0) = "#NAME#, i'm not here to do your job!"
messages$(398, 1) = "#NAME#, ÿ çäåñü íå äëÿ òîãî, ÷òîáû äåëàòü òâîþ ðàáîòó!"
messages$(398, 0) = "#FIRST#, i'm not here to do your job!"
messages$(398, 1) = "#FIRST#, ÿ çäåñü íå äëÿ òîãî, ÷òîáû äåëàòü òâîþ ðàáîòó!"

messages$(399, 0) = "#NAME#, this court has seen you accused"
messages$(399, 1) = "#NAME#, âû îáâèíÿåòåñü â"
messages$(399, 0) = "#FIRST#, this court has seen you accused"
messages$(399, 1) = "#FIRST#, âû îáâèíÿåòåñü â"

messages$(400, 0) = "'s recent death is just one of"
messages$(400, 1) = "íåäàâíÿÿ ñìåðòü - ëèøü îäíà èç"
Expand Down Expand Up @@ -190,11 +190,11 @@ messages$(413, 1) = "
messages$(414, 0) = "A prisoner has no right to such weapons..."
messages$(414, 1) = "Çàêëþ÷åííûé íå èìååò ïðàâà íà íîøåíèå îðóæèÿ..."

messages$(415, 0) = "ATTENTION! Prisoner #NAME# is under"
messages$(415, 1) = "ÂÍÈÌÀÍÈÅ! Çàêëþ÷åííûé #NAME# áûë"
messages$(415, 0) = "ATTENTION! Prisoner #FIRST# is under"
messages$(415, 1) = "ÂÍÈÌÀÍÈÅ! Çàêëþ÷åííûé #FIRST# áûë"

messages$(416, 0) = "ATTENTION! Prisoner #NAME# is wanted for"
messages$(416, 1) = "ÂÍÈÌÀÍÈÅ! Çàêëþ÷åííûé #NAME# ðàçûñêèâàåòñÿ çà"
messages$(416, 0) = "ATTENTION! Prisoner #FIRST# is wanted for"
messages$(416, 1) = "ÂÍÈÌÀÍÈÅ! Çàêëþ÷åííûé #FIRST# ðàçûñêèâàåòñÿ çà"

messages$(417, 0) = "After hearing each of your statements and reviewing"
messages$(417, 1) = "Âûñëóøàâ êàæäîå âàøå óòâåðæäåíèå è ïðîñìîòðåâ"
Expand Down Expand Up @@ -244,8 +244,8 @@ messages$(431, 1) = "
messages$(432, 0) = "I find you GUILTY and sentence you to"
messages$(432, 1) = "Âû ÂÈÍÎÂÍÛ è ïðèãîâàðèâàòåñü ê"

messages$(433, 0) = "I found that #NAME#, and was on my way to"
messages$(433, 1) = "ß íàøåë #NAME# è õîòåë"
messages$(433, 0) = "I found that #FIRST#, and was on my way to"
messages$(433, 1) = "ß íàøåë #FIRST# è õîòåë"

messages$(434, 0) = "I have no choice but to seize your bank account"
messages$(434, 1) = "ß äîëæåí êîíôèñêîâàòü âàø áàíêîâñêèé ñ÷åò"
Expand Down Expand Up @@ -370,8 +370,8 @@ messages$(473, 1) = "
messages$(474, 0) = "Since you obviously need more time to think about"
messages$(474, 1) = "Ïîñêîëüêó âàì, î÷åâèäíî, íóæíî áîëüøå âðåìåíè, ÷òîáû ïîäóìàòü î"

messages$(475, 0) = "So, #NAME#, what's the story?"
messages$(475, 1) = "Èòàê, #NAME#, â ÷åì äåëî?"
messages$(475, 0) = "So, #FIRST#, what's the story?"
messages$(475, 1) = "Èòàê, #FIRST#, â ÷åì äåëî?"

messages$(476, 0) = "Sorry to blow your high, "
messages$(476, 1) = "Èçâèíè, ÷òî âçîðâàë òåáÿ, "
Expand Down Expand Up @@ -517,8 +517,8 @@ messages$(522, 1) = "
messages$(523, 0) = "You've got no reason to be outside of your block"
messages$(523, 1) = "Ó âàñ íå áûëî ïðè÷èí áûòü âíå êàìåðû"

messages$(524, 0) = "You've got quite an imagination, #NAME#!"
messages$(524, 1) = "Ó òåáÿ õîðîøåå âîîáðàæåíèå, #NAME#!"
messages$(524, 0) = "You've got quite an imagination, #FIRST#!"
messages$(524, 1) = "Ó òåáÿ õîðîøåå âîîáðàæåíèå, #FIRST#!"

messages$(525, 0) = "You've thrown your last punch, "
messages$(525, 1) = "Òû íàíåñ ñâîé ïîñëåäíèé óäàð, "
Expand Down Expand Up @@ -559,17 +559,17 @@ messages$(536, 1) = "
messages$(537, 0) = "arrest for assaulting a warden!"
messages$(537, 1) = "àððåñòîâàí çà íàïàäåíèå íà ñìîòðèòåëÿ!"

messages$(538, 0) = "arrest for carrying a #NAME#!"
messages$(538, 1) = "àðåñòîâàí çà íîøåíèå #NAME#!"
messages$(538, 0) = "arrest for carrying a #FIRST#!"
messages$(538, 1) = "àðåñòîâàí çà íîøåíèå #FIRST#!"

messages$(539, 0) = "arrest for conspiring to escape!"
messages$(539, 1) = "àðåñòîâàí çà ñãîâîð ñ öåëüþ ïîáåãà!"

messages$(540, 0) = "arrest for disobeying the prison rules!"
messages$(540, 1) = "àðåñòîâàí çà íåñîáëþäåíèå òþðåìíîãî ðàñïîðÿäêà!"

messages$(541, 0) = "arrest for trading #NAME#!"
messages$(541, 1) = "àðåñòîâàí çà ïðîäàæó #NAME#!"
messages$(541, 0) = "arrest for trading #FIRST#!"
messages$(541, 1) = "àðåñòîâàí çà ïðîäàæó #FIRST#!"

messages$(542, 0) = "assaulting another inmate!"
messages$(542, 1) = "íàïàäåíèå íà äðóãîãî çàêëþ÷åííîãî!"
Expand Down Expand Up @@ -631,8 +631,8 @@ messages$(560, 1) = "
messages$(561, 0) = "many that can be traced back to this psycho!"
messages$(561, 1) = "ìíîãî ÷åãî ìîæíî ïðîñëåäèòü äî ýòîãî ïñèõà!"

messages$(562, 0) = "mutilating the body of #NAME#!"
messages$(562, 1) = "íàíåñåíèå òÿæêèõ òåëåñíûõ ïîâðåæäåíèé #NAME#!"
messages$(562, 0) = "mutilating the body of #NAFIRSTME#!"
messages$(562, 1) = "íàíåñåíèå òÿæêèõ òåëåñíûõ ïîâðåæäåíèé #FIRST#!"

messages$(563, 0) = "of "
messages$(563, 1) = "â "
Expand Down Expand Up @@ -661,8 +661,8 @@ messages$(570, 1) = "
messages$(571, 0) = "simple exchange of resources between friends..."
messages$(571, 1) = "ïðîñòîé îáìåí ðåñóðñàìè ìåæäó äðóçüÿìè..."

messages$(572, 0) = "stealing a #NAME#!"
messages$(572, 1) = "êðàæó #NAME#!"
messages$(572, 0) = "stealing a #FIRST#!"
messages$(572, 1) = "êðàæó #FIRST#!"

messages$(573, 0) = "still be alive if you were doing your job!"
messages$(573, 1) = "âñå åùå æèâ, åñëè òû âûïîëíÿåøü ñâîþ ðàáîòó!"
Expand All @@ -679,20 +679,20 @@ messages$(576, 1) = "
messages$(577, 0) = "that this "
messages$(577, 1) = "÷òî ýòî "

messages$(578, 0) = "that this #NAME# was used for any crime!"
messages$(578, 1) = "÷òî #NAME# èñïîëüçîâàí â ïðåñòóïíûõ öåëÿõ!"
messages$(578, 0) = "that this #FIRST# was used for any crime!"
messages$(578, 1) = "÷òî #FIRST# èñïîëüçîâàí â ïðåñòóïíûõ öåëÿõ!"

messages$(579, 0) = "that, i'm adding another "
messages$(579, 1) = "ýòî, ÿ äîáàâëÿþ åùå "

messages$(580, 0) = "the attempted murder of #NAME#!"
messages$(580, 1) = "ïîêóøåíèå íà óáèéñòâî #NAME#!"
messages$(580, 0) = "the attempted murder of #FIRST#!"
messages$(580, 1) = "ïîêóøåíèå íà óáèéñòâî #FIRST#!"

messages$(581, 0) = "the evidence, this court rules in favour of..."
messages$(581, 1) = "äîêàçàòåëüñòâà, ýòîò ñóä ïðèíèìàåò ðåøåíèå â ïîëüçó..."

messages$(582, 0) = "the murder of #NAME#!"
messages$(582, 1) = "óáèéñòâî #NAME#!"
messages$(582, 0) = "the murder of #FIRST#!"
messages$(582, 1) = "óáèéñòâî #FIRST#!"

messages$(583, 0) = "the one you've wasted! Take it as a warning..."
messages$(583, 1) = "íàâåðñòàòü òîò, êîòîðûé âû ïîòðàòèëè âïóñòóþ!"
Expand All @@ -718,8 +718,8 @@ messages$(589, 1) = "
messages$(590, 0) = "use of the medication that the prison provides..."
messages$(590, 1) = "ïðèìåíÿë ëåêàðñòâà, êîòîðûå ïðåäîñòàâëÿåò òþðüìà..."

messages$(591, 0) = "using a #NAME# as a weapon!"
messages$(591, 1) = "èñïîëüçîâàíèå #NAME# êàê îðóæèÿ!"
messages$(591, 0) = "using a #FIRST# as a weapon!"
messages$(591, 1) = "èñïîëüçîâàíèå #FIRST# êàê îðóæèÿ!"

messages$(592, 0) = "weapon! He intended to do some serious damage..."
messages$(592, 1) = "îðóæèå! Îí íàìåðåâàëñÿ íàíåñòè ñåðüåçíûé óùåðá..."
Expand Down
4 changes: 2 additions & 2 deletions translate_plugin/lang/Others.bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
messages$(0, 0) = "#COUNT# characters"
messages$(0, 1) = "#COUNT# ïåðñîíàæåé"
messages$(0, 0) = "#FIRST# characters"
messages$(0, 1) = "#FIRST# ïåðñîíàæåé"

messages$(1, 0) = "<<< BACK <<<"
messages$(1, 1) = "<<< ÍÀÇÀÄ <<<"
Expand Down
4 changes: 2 additions & 2 deletions translate_plugin/lang/Players.bb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
messages$(1428, 0) = "Loading Character #NUMBER# of "
messages$(1428, 1) = "Çàãðóçêà ïåðñîíàæåé #NUMBER# èç "
messages$(1428, 0) = "Loading Character #FIRST# of #SECOND#"
messages$(1428, 1) = "Çàãðóçêà ïåðñîíàæåé #FIRST# èç #SECOND#"
16 changes: 8 additions & 8 deletions translate_plugin/lang/Values.bb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
messages$(31, 0) = "Loading Arm #NUMBER# of "
messages$(31, 1) = "Çàãðóçêà ðóê #NUMBER# èç "
messages$(31, 0) = "Loading Arm #FIRST# of #SECOND#"
messages$(31, 1) = "Çàãðóçêà ðóê #FIRST# èç #SECOND#"

messages$(32, 0) = "Loading Body #NUMBER# of "
messages$(32, 1) = "Çàãðóçêà òåë #NUMBER# èç "
messages$(32, 0) = "Loading Body #FIRST# of #SECOND#"
messages$(32, 1) = "Çàãðóçêà òåë #FIRST# èç #SECOND#"

messages$(33, 0) = "Loading Face #NUMBER# of "
messages$(33, 1) = "Çàãðóçêà ëèö #NUMBER# èç "
messages$(33, 0) = "Loading Face #FIRST# of #SECOND#"
messages$(33, 1) = "Çàãðóçêà ëèö #FIRST# èç #SECOND#"

messages$(34, 0) = "Loading Legs #NUMBER# of "
messages$(34, 1) = "Çàãðóçêà íîã #NUMBER# èç "
messages$(34, 0) = "Loading Legs #FIRST# of #SECOND#"
messages$(34, 1) = "Çàãðóçêà íîã #FIRST# èç #SECOND#"

messages$(35, 0) = "Loading Numbers"
messages$(35, 1) = "Çàãðóçêà çíà÷åíèé"
Expand Down

0 comments on commit 3639241

Please sign in to comment.