From 3ff1ed716e9d8bdbc113f6f7b5a1f9c458e5e9b6 Mon Sep 17 00:00:00 2001 From: Marc Fokkert Date: Tue, 9 Jul 2024 21:05:47 +0200 Subject: [PATCH] Initial commit --- .idea/.gitignore | 8 + .idea/misc.xml | 10 + .idea/modules.xml | 8 + .idea/unity-client-translations.iml | 8 + default.ipynb | 121 ++++ english_translations.ipynb | 855 ++++++++++++++++++++++++++++ 6 files changed, 1010 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/unity-client-translations.iml create mode 100644 default.ipynb create mode 100644 english_translations.ipynb diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..20b24b9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..bb3ec84 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/unity-client-translations.iml b/.idea/unity-client-translations.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/unity-client-translations.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/default.ipynb b/default.ipynb new file mode 100644 index 0000000..0b78c9f --- /dev/null +++ b/default.ipynb @@ -0,0 +1,121 @@ +{ + "cells": [ + { + "cell_type": "code", + "id": "initial_id", + "metadata": { + "collapsed": true, + "ExecuteTime": { + "end_time": "2024-07-05T15:11:38.213293Z", + "start_time": "2024-07-05T15:11:38.113796Z" + } + }, + "source": [ + "import os\n", + "import re\n", + "import json\n", + "\n", + "def load_translations(json_file):\n", + " with open(json_file, 'r', encoding='utf-8') as f:\n", + " return json.load(f)\n", + "\n", + "def to_camel_case(s):\n", + " parts = s.split('_')\n", + " return parts[0].lower() + ''.join(word.capitalize() for word in parts[1:])\n", + "\n", + "\n", + "def replace_content(content, pattern, translations):\n", + " matches = pattern.findall(content)\n", + " for match in matches:\n", + " translation_key = match.strip()\n", + " translated_value = translations.get(translation_key, \"\")\n", + " replacement = f'{translated_value}'\n", + " content = re.sub(r\"(?