Skip to content

Commit

Permalink
locale validator fix (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
pxc1984 authored Dec 4, 2024
1 parent 975b1cd commit 7c9358e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/_strings/_lust/emotes/erp.ftl
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
emote-moan = стонет!
chat-emote-name = Стонать
2 changes: 1 addition & 1 deletion Resources/Prototypes/_Lust/ERP/Other/emotes.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- type: emote
id: Moan
name: Стонать
name: chat-emote-name-moan
category: Vocal
icon: Interface/Emotes/sigh.png
whitelist:
Expand Down
27 changes: 25 additions & 2 deletions Tools/_sunrise/Schemas/ignore_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ignore_list:
- 'orange'
- '$count'
- 'v1'
- 'Nanotrasen'
- 'Nanotrasen'
- 'float'
- '$open'
- '$rate'
Expand Down Expand Up @@ -135,6 +135,11 @@ ignore_list:
- 'Telegram'
- 'AMLG-90'
- 'TR-263'
# Sunrise-Lust start
- 'Qillu'
- 'QL'
- 'ERP'
# Sunrise-Lust end

ignore_files:
- 'italian.ftl'
Expand All @@ -147,4 +152,22 @@ ignore_files:
- 'german.ftl'
- 'southern.ftl'
- 'tts-voices-sunrise.ftl'
- 'lobby.ftl'
- 'lobby.ftl'
# Sunrise-Lust start
- 'friendly_interactions.yml'
- 'anal_interactions.yml'
- 'ears_interactions.yml'
- 'neck_interactions.yml'
- 'pussy_interactions.yml'
- 'cock_interactions.yml'
- 'mouth_interactions.yml'
- 'lips_interactions.yml'
- 'boobs_interactions.yml'
- 'face_interactions.yml'
- 'feet_interactions.yml'
- 'horn_interactions.yml'
- 'cheeks_interactions.yml'
- 'thighs_interactions.yml'
- 'toyInteractions.yml'
- 'butt_interactions.yml'
# Sunrise-Lust end
15 changes: 9 additions & 6 deletions Tools/_sunrise/Schemas/validate_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def check_translations(root_dir, ignore_list, ignore_files):
add_error(rel_path, line_num, f'Не переведённая строка "{key}": {line.strip()}')
elif is_english(value):
add_error(rel_path, line_num, f'Не переведённая строка "{key}": {line.strip()}')

#for dirpath, _, filenames in os.walk(en_locale_dir):
# for filename in filenames:
# if filename.endswith('.ftl'):
Expand All @@ -92,14 +92,17 @@ def check_translations(root_dir, ignore_list, ignore_files):
# elif has_russian(value):
# add_error(rel_path, line_num, f'Русская строка "{key}": {line.strip()}')

def check_yml_files(dir: str, ignore_list: List[str]):
def check_yml_files(dir: str, ignore_list: List[str], ignore_files: List[str]): # Sunrise-Lust edit
key_pattern = re.compile(r'^(name|description|suffix|rules|desc):\s*(.+)')

for yml_rel in iglob("**/*.yml", root_dir=dir, recursive=True):
if any(ignored in yml_rel for ignored in ignore_files): # Sunrise-Lust edit
continue # Sunrise-Lust edit

yml_path = os.path.join(dir, yml_rel)
with open(yml_path, 'r', encoding='utf-8') as file:
content = file.readlines()

for i, line in enumerate(content, start=1):
match = key_pattern.match(line.strip())
if match:
Expand All @@ -124,12 +127,12 @@ def load_ignore_list(ignore_file):

check_translations(args.localization_dir, ignore_list, ignore_files)

check_yml_files(args.yml_dir, ignore_list)
check_yml_files(args.yml_dir, ignore_list, ignore_files) # Sunrise-Lust edit

if errors:
for error in errors:
print(f"{error.path} (строка {error.line}): {error.message}")
sys.exit(1)
else:
print("Ошибок не найдено.")
sys.exit(0)
sys.exit(0)

0 comments on commit 7c9358e

Please sign in to comment.