Skip to content

Commit

Permalink
fixed text formatting duplicate errors
Browse files Browse the repository at this point in the history
  • Loading branch information
piterson05 committed Sep 12, 2023
1 parent 28350d5 commit 0058519
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion imenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@
<String xml:lang="nl-NL">{0} kan niet ~r~{1} ~s~meer ~r~{2} ~s~dragen.</String>
<String xml:lang="tr-TR">{0} taşıyamaz ~r~{1} ~s~daha fazlasını ~r~{2}~s~.</String>
<String xml:lang="de-DE">{0} kann nicht ~r~{1} ~s~weitere/n ~r~{2}~s~ halten.</String>
<String xml:lang="it-IT">{0} non può contenere altri ~r~{1} ~r~{2}~s~.</String>
<String xml:lang="it-IT">{0} non può contenere altri ~r~{1}~s~ ~r~{2}~s~.</String>
<String xml:lang="fr-FR">{0} ne peut pas porter plus de ~r~{1} {2}~s~.</String>
<String xml:lang="zh-Hant">{0} 無法攜帶 ~r~{1} ~s~個或以上的 ~r~{2}~s~.</String>
<String xml:lang="zh-Hans">{0} 无法携带 ~r~{1} ~s~个或以上的 ~r~{2}~s~.</String>
Expand Down
2 changes: 1 addition & 1 deletion jobs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
<String xml:lang="en-US">You purchased ~p~{0}g ~s~of ~p~{1} ~s~for ~r~{2}~s~</String>
<String xml:lang="it-IT">Hai comprato ~p~{0}g ~s~di ~p~{1} ~s~per ~r~{2}~s~</String>
<String xml:lang="nl-NL">Je hebt ~p~{0}g ~s~van ~p~{1} ~s~gekocht voor ~r~{2}~s~</String>
<String xml:lang="de-DE">Du hast ~p~{0}g ~p~{1} ~s~für ~r~{2}~s~ gekauft</String>
<String xml:lang="de-DE">Du hast ~p~{0}g~s~ ~p~{1} ~s~für ~r~{2}~s~ gekauft</String>
<String xml:lang="tr-TR">Satın aldın ~p~{0}g ~s~ile ilgili ~p~{1} ~s~için ~r~{2}~s~</String>
<String xml:lang="es-ES">Compraste ~p~{0}g ~s~de ~p~{1} ~s~por ~r~{2}~s~</String>
<String xml:lang="pl-PL">Kupiłeś ~p~{0}g ~s~~p~{1} ~s~za ~r~{2}~s~</String>
Expand Down
2 changes: 1 addition & 1 deletion player.xml
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@
<String xml:lang="it-IT">Questo giocatore ha ~r~recentemente ~s~ricevuto denaro. Per favore, prova ~r~più tardi~s~.</String>
<String xml:lang="pl-PL">Ten gracz otrzymał ~r~przed chwilą ~s~pieniądze. Proszę, spróbuj ponownie ~r~później~s~.</String>
<String xml:lang="es-ES">Este jugador ha ~r~recientemente ~s~recibido dinero. Por favor, inténtelo de nuevo ~r~más tarde~s~.</String>
<String xml:lang="pt-BR">Este jogador ~r~recebeu dinheiro recentemente~s~. Por favor, tente novamente ~r~mais tarde ~r~mais tarde~s~.</String>
<String xml:lang="pt-BR">Este jogador ~r~recebeu dinheiro recentemente~s~. Por favor, tente novamente ~r~mais tarde~s~.</String>
</Entry>

<Entry Id="dont_have_vehicle_with_plate">
Expand Down
9 changes: 5 additions & 4 deletions validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,11 @@ def regex_replace_multiple(text: str, replacement_table: list[list[str]]) -> str
text = re.sub(replacement[0], replacement[1], text)
return text

def get_consecutive_duplicate(lst: list):
def get_consecutive_duplicate(lst: list, exceptions: list = []):
for i in range(len(lst) - 1):
if lst[i] == lst[i + 1]:
return lst[i]
if lst[i] not in exceptions:
if lst[i] == lst[i + 1]:
return lst[i]
return None


Expand Down Expand Up @@ -589,7 +590,7 @@ def check_entries(entry: xml.dom.minidom.Element, path: list[str]):
found_formats_set = set(found_formats)
invalid_text_formatting = found_formats_set.difference(required_text_formatting)
missing_text_formatting = required_text_formatting.difference(found_formats_set)
formatting_duplicate = get_consecutive_duplicate(found_formats)
formatting_duplicate = get_consecutive_duplicate(found_formats, exceptions=["~h~","~n~","~s~"])
if invalid_text_formatting:
Validator.print_error(f"Found invalid text formatting: {', '.join(invalid_text_formatting)}", path1, string_entry.parse_position)
if missing_text_formatting:
Expand Down

0 comments on commit 0058519

Please sign in to comment.