diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | locale/en.ini | 2 | ||||
-rw-r--r-- | template.org.metamuffin.hurrycurry.client.desktop (renamed from org.metamuffin.hurrycurry.client.desktop) | 2 | ||||
-rw-r--r-- | template.org.metamuffin.hurrycurry.client.metainfo.xml (renamed from org.metamuffin.hurrycurry.client.metainfo.xml) | 32 | ||||
-rw-r--r-- | translate.py | 80 |
5 files changed, 92 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ee2643 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +org.metamuffin.hurrycurry.client.* diff --git a/locale/en.ini b/locale/en.ini index 25fc41e..f458ec5 100644 --- a/locale/en.ini +++ b/locale/en.ini @@ -6,6 +6,7 @@ i.contribute=Contribute i.credits.contributers=Other contributers include Sofviic, BigBrotherNii and RustyStriker. Detailed credits can be found in-game. i.credits.primary=The game is primarily being developed by {_developers}. i.credits=Credits +i.flatpak.controller.par=Controller support is currently disabled by default due to Flathub limitations. To enable it, run <code>flatpak override --device=input org.metamuffin.hurrycurry.client</code>. i.gameplay_overview.par=Customers enter your restaurant and order various meals. Your task is to assemble these meals by cutting, cooking, baking, searing and combining resources in the kitchen. Multitasking is crucial, but can lead to food burning or customers leaving if you take too long. There are many different restaurant/kitchen layouts to choose from. i.gameplay_overview=Gameplay Overview i.have_fun=Have fun! @@ -17,3 +18,4 @@ i.how_to_play=How to play i.installation.par=The source code repository is available on {_a_codeberg}Codeberg{_a_end}. Prebuilt packages can be downloaded from one of the following sources: i.installation=Installation i.public_servers=Public Servers +i.short_desc=A game about cooking
\ No newline at end of file diff --git a/org.metamuffin.hurrycurry.client.desktop b/template.org.metamuffin.hurrycurry.client.desktop index ca74768..1da13a5 100644 --- a/org.metamuffin.hurrycurry.client.desktop +++ b/template.org.metamuffin.hurrycurry.client.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Name=Hurry Curry! Icon=org.metamuffin.hurrycurry.client -GenericName[de]=Ein Spiel rund ums Kochen +GenericName[LANG]=i.short_desc GenericName=A game about cooking Exec=hurrycurry Terminal=false diff --git a/org.metamuffin.hurrycurry.client.metainfo.xml b/template.org.metamuffin.hurrycurry.client.metainfo.xml index 6ab1465..210351f 100644 --- a/org.metamuffin.hurrycurry.client.metainfo.xml +++ b/template.org.metamuffin.hurrycurry.client.metainfo.xml @@ -29,28 +29,12 @@ </recommends> <description> - <p> - Hurry Curry! is a multiplayer game about cooking. Your goal is to run a - restaurant and gain points by serving meals you've cooked. </p> - <p> - Keyboard Controls: Move character with WASD. Move camera with arrow keys. - Interact with Space or J. Boost with Left Shift or K. Open/close menus with Escape. - Press Enter to open chat. Reset view with R. </p> - <p> - Controller support is currently disabled by default due to Flathub limitations. To - enable it, run - <code>flatpak override --device=input org.metamuffin.hurrycurry.client</code>. - Controller Controls: Move character with Left - Stick. Move camera with Right Stick. Interact with A, Boost with B, Open/close menus - with Menu button. Use keyboard for chat. Reset view with Y. </p> - <p> - Touch support is currently unavailable on Wayland due to Godot limitations. To enable it, run - <code>flatpak override --nosocket=wayland org.metamuffin.hurrycurry.client</code>. </p> - <p> - Game developed by nokoe, metamuffin, tpart. Special thanks to RustyStriker for - playtesting and technical assistance. - Thanks to Sofviic for most of the maps. - </p> + <p xml:lang="LANG">i.abstract</p> + <p xml:lang="LANG">i.gameplay_overview.par</p> + <p xml:lang="LANG">i.how_to_play.keyboard_controls</p> + <p xml:lang="LANG">i.how_to_play.controller_controls</p> + <p xml:lang="LANG">i.flatpak.controller.par</p> + <p xml:lang="LANG">i.credits.primary</p> </description> <launchable type="desktop-id">org.metamuffin.hurrycurry.client.desktop</launchable> @@ -103,7 +87,7 @@ <li>Ask for consent to contact registry</li> </ul> </description> - <url>https://codeberg.org/hurrycurry/hurrycurry/releases/tag/v2.1.1</url> + <url>https://codeberg.org/hurrycurry/hurrycurry/releases/tag/v2.1.0</url> </release> <release version="2.1.0" date="2024-09-30" type="stable"> <description> @@ -245,4 +229,4 @@ <url>https://codeberg.org/hurrycurry/hurrycurry/releases/tag/v1.0.0</url> </release> </releases> -</component>
\ No newline at end of file +</component> diff --git a/translate.py b/translate.py new file mode 100644 index 0000000..39c5745 --- /dev/null +++ b/translate.py @@ -0,0 +1,80 @@ +#!/usr/bin/python +# translate.py +# Copyright 2024 nokoe +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# + +import os +import re +from string import Template + +templates = { + '{_a_browser_version}': '', + '{_a_book}': '', + '{_a_codeberg}': '', + '{_a_weblate}': '', + '{_a_end}': '', + '{_b}': '<em>', + '{_b_end}': '</em>', + '{_developers}': 'nokoe, metamuffin, tpart', +} + + +def add_languages(file, regex, format, langs): + with open(file) as f: + text = f.read() + for line in text.splitlines(): + m = regex.match(line) + if m: + w = m.group(1) + key = m.group(2).strip() + translate = m.group(3).strip() + to_substitute = [] + for lang in langs.keys(): + if translate in langs[ + lang] and not langs[lang][translate].strip() == "": + translated = langs[lang][translate] + for k in templates.keys(): + translated = translated.replace(k, templates[k]) + to_substitute.append( + format.substitute(key=key, + value=translated, + lang=lang, + w=w)) + text = text.replace(m.string, "\n".join(to_substitute)) + new_file = open(f.name.removeprefix("template."), "w") + new_file.write(text) + + +langs = {} +for i in [ + x for x in os.scandir("locale") + if x.is_file() and x.name.endswith(".ini") +]: + lang = i.name.removesuffix(".ini") + translations = {} + f = open(i) + next(f) + for line in f: + key, value = line.split("=", 1) + translations[key.strip()] = value.strip() + langs[lang] = translations + +add_languages("template.org.metamuffin.hurrycurry.client.desktop", + re.compile(r"^(\s*)(.*)\[LANG\]=(.*)$"), + Template("$w$key[$lang]=$value"), langs) + +add_languages("template.org.metamuffin.hurrycurry.client.metainfo.xml", + re.compile(r"(\s*)<(.*)\s*xml:lang=\"LANG\"\s*>(.*)</.*>"), + Template("$w<$key xml:lang=\"$lang\">$value</$key>"), langs) |