Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18n modpack and CHS local #238

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/generator/minecraft-gateway/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export const mobData: MobData[] = [
color: ColorName.Orange,
gatewayTypes: [GatewayType.Normal, GatewayType.Titan],
minLightLevel: 0,
maxLightLevel: 15,
maxLightLevel: 7,
spawnOverrides: {
block: {
tag: "skyfactory_5:this_is_where_nether_mobs_need_to_spawn_and_it_probably_works",
Expand Down
2 changes: 2 additions & 0 deletions src/minecraft/config/apotheosis/spawner.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ spawn_eggs {
# Should match between client and server.
# Default: [
S:"Banned Mobs" <
minecraft:ender_dragon
ghastcow:ghast_cow
>
}

Expand Down
7 changes: 4 additions & 3 deletions src/minecraft/config/biggerreactors-server.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ mode = "MODERN"
# Valid range: [3,)
# Default: 128
#
MaxLength = 32
MaxLength = 128
#
# Valid range: [3,)
# Default: 128
#
MaxWidth = 32
MaxWidth = 128
#
# Valid range: [3,)
# Default: 192
#
MaxHeight = 48
MaxHeight = 192
#
# Valid range: (0,)
# Default: 1.0
Expand All @@ -50,6 +50,7 @@ ActiveOutputMultiplier = 1.0
# Default: 1000
#
FuelMBPerIngot = 1000
FuelOutputItem = "immersiveengineering:ingot_uranium"
#
# Default: false
#
Expand Down
3 changes: 2 additions & 1 deletion src/minecraft/config/carryon-common.toml
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ forbiddenTiles = [
"enderio:item_conduit",
"enderio:dense_me_conduit",
"enderio:me_conduit",
"refurbished_furniture:*"
"refurbished_furniture:*",
"draconicevolution:*"
]
# Entities that cannot be picked up
forbiddenEntities = [
Expand Down
86 changes: 86 additions & 0 deletions src/minecraft/config/checklist/generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Code by Copilot
# This script is used to generate translation keys for task files and write them to a json file
import json

def generate_translation_keys(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()

translation_keys = {}
key_prefix = "skyfactory_5.task."
key_counter = 1
updated_lines = []

for line in lines:
stripped_line = line.strip()
if stripped_line == "===" or stripped_line == "":
updated_lines.append(line)
continue
if stripped_line.startswith("# "):
key = f"{key_prefix}{key_counter}"
translation_keys[key] = stripped_line[2:]
updated_lines.append(f"#{key}\n")
key_counter += 1
elif stripped_line.startswith("#"):
key = f"{key_prefix}{key_counter}"
translation_keys[key] = stripped_line[1:]
updated_lines.append(f"#{key}\n")
key_counter += 1
else:
key = f"{key_prefix}{key_counter}"
translation_keys[key] = stripped_line
updated_lines.append(f"{key}\n")
key_counter += 1

return translation_keys, updated_lines

def write_translation_keys(translation_keys, output_file_path):
with open(output_file_path, 'w', encoding='utf-8') as file:
json.dump(translation_keys, file, ensure_ascii=False, indent=4)

def update_input_file(file_path, updated_lines):
with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(updated_lines)

def replace_keys_with_values(file_path, translation_keys_path):
with open(translation_keys_path, 'r', encoding='utf-8') as file:
translation_keys = json.load(file)

with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()

updated_lines = []
for line in lines:
stripped_line = line.strip()
if stripped_line.startswith("# "):
key = stripped_line[2:]
updated_lines.append(f"# {translation_keys.get(key, key)}\n")
elif stripped_line.startswith("#"):
key = stripped_line[1:]
updated_lines.append(f"#{translation_keys.get(key, key)}\n")
else:
key = stripped_line
updated_lines.append(f"{translation_keys.get(key, key)}\n")

update_input_file(file_path, updated_lines)

if __name__ == "__main__":
print("Mode: ")
print("1. Generate translation keys")
print("2. Write translation keys")
mode = input("Input mode number: ").strip()

if mode == "1":
file_path = input("Input task file: ").strip()
translation_keys, updated_lines = generate_translation_keys(file_path)
write_translation_keys(translation_keys, "translations.json")
update_input_file(file_path, updated_lines)
print(f"Translation keys have been written to translations.json")
print(f"Input file {file_path} has been updated with translation keys")
elif mode == "2":
file_path = input("Input task file: ").strip()
translation_keys_path = input("Input lang file: ").strip()
replace_keys_with_values(file_path, translation_keys_path)
print(f"Input file {file_path} has been updated with translation values from {translation_keys_path}")
else:
print("Invaild mode number")
Loading