Update: 2026-07-29 19:44:57

This commit is contained in:
Hamza-Ayed
2026-07-29 19:44:58 +03:00
parent 2cf5c63a1e
commit 90d976e1d1
110 changed files with 2238 additions and 2071 deletions
+22
View File
@@ -0,0 +1,22 @@
import os
import shutil
SRC_BASE = "/Users/hamzaaleghwairyeen/development/App/Intaleq"
DEST_RIDER = "/Users/hamzaaleghwairyeen/development/App/IntaleqApp/intaleq_rider"
DEST_DRIVER = "/Users/hamzaaleghwairyeen/development/App/IntaleqApp/intaleq_driver"
# Copy iOS AppIcon
src_appicon = os.path.join(SRC_BASE, "ios/Runner/Assets.xcassets/AppIcon.appiconset")
if os.path.exists(src_appicon):
shutil.copytree(src_appicon, os.path.join(DEST_RIDER, "ios/Runner/Assets.xcassets/AppIcon.appiconset"), dirs_exist_ok=True)
shutil.copytree(src_appicon, os.path.join(DEST_DRIVER, "ios/Runner/Assets.xcassets/AppIcon.appiconset"), dirs_exist_ok=True)
print("iOS AppIcon set copied successfully.")
# Copy Android mipmap folders
mipmaps = ["mipmap-hdpi", "mipmap-mdpi", "mipmap-xhdpi", "mipmap-xxhdpi", "mipmap-xxxhdpi"]
for mm in mipmaps:
src_mm = os.path.join(SRC_BASE, "android/app/src/main/res", mm)
if os.path.exists(src_mm):
shutil.copytree(src_mm, os.path.join(DEST_RIDER, "android/app/src/main/res", mm), dirs_exist_ok=True)
shutil.copytree(src_mm, os.path.join(DEST_DRIVER, "android/app/src/main/res", mm), dirs_exist_ok=True)
print(f"Android {mm} copied successfully.")
+82
View File
@@ -0,0 +1,82 @@
import os
import re
import subprocess
TRANS_DIRS = [
"/Users/hamzaaleghwairyeen/development/App/IntaleqApp/intaleq_driver/lib/controller/local",
"/Users/hamzaaleghwairyeen/development/App/IntaleqApp/intaleq_rider/lib/controller/local",
]
def get_git_head_content(rel_path):
try:
res = subprocess.run(
["git", "show", f"HEAD:{rel_path}"],
capture_output=True,
text=True,
check=True
)
return res.stdout
except Exception as e:
print(f"Error getting git head for {rel_path}: {e}")
return None
def process_translation_file(filepath):
repo_root = "/Users/hamzaaleghwairyeen/development/App/IntaleqApp"
rel_path = os.path.relpath(filepath, repo_root)
head_content = get_git_head_content(rel_path)
if not head_content:
return
with open(filepath, "r", encoding="utf-8", errors="ignore") as f:
current_lines = f.readlines()
head_lines = head_content.splitlines(keepends=True)
if len(current_lines) != len(head_lines):
print(f"Line count mismatch for {rel_path} ({len(current_lines)} vs {len(head_lines)})")
return
new_lines = []
restored_keys = 0
# Pattern for map entries: "key": "value",
pattern = re.compile(r'^\s*"(.*?)":\s*"(.*?)",?\s*$')
for curr_line, head_line in zip(current_lines, head_lines):
m_curr = pattern.match(curr_line)
m_head = pattern.match(head_line)
if m_curr and m_head:
orig_key, orig_val = m_head.group(1), m_head.group(2)
curr_key, curr_val = m_curr.group(1), m_curr.group(2)
if orig_key != curr_key:
# Key was changed! Restore orig_key, but keep curr_val
# Preserve leading indent & formatting
indent = curr_line[:curr_line.find('"')]
has_comma = curr_line.rstrip().endswith(",")
comma = "," if has_comma else ""
fixed_line = f'{indent}"{orig_key}": "{curr_val}"{comma}\n'
new_lines.append(fixed_line)
restored_keys += 1
else:
new_lines.append(curr_line)
else:
new_lines.append(curr_line)
if restored_keys > 0:
with open(filepath, "w", encoding="utf-8") as f:
f.writelines(new_lines)
print(f"Fixed {restored_keys} keys in {rel_path}")
def main():
print("Fixing translation keys in driver & rider local translation files...\n")
for d in TRANS_DIRS:
for file in os.listdir(d):
if file.endswith(".dart"):
filepath = os.path.join(d, file)
process_translation_file(filepath)
if __name__ == "__main__":
main()