Skip to content

Commit

Permalink
add dockstrs, remove 24/h in cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
mrf0rtuna4 committed May 6, 2024
1 parent f4d0979 commit 07ca24b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/translate-readme.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Generate Localized Readme

on:
schedule:
- cron: "0 */24 * * *"

workflow_dispatch:

push:
Expand All @@ -21,7 +18,7 @@ jobs:
uses: mrf0rtuna4/Github-Readme-AutoTranslator@master
env:
GITHUB_TOKEN: ${{ secrets.GTK }}
LANGS: 'serbian,italian,russian'
LANGS: 'serbian,italian,russian,japan'

- name: Push to GitHub
uses: crazy-max/ghaction-github-pages@v3.1.0
Expand Down
19 changes: 18 additions & 1 deletion core/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@


async def decompile_readme():
"""
Decompile the README file into chunks and extract code blocks, links, and HTML tags.
:return: Tuple containing the chunks of text and a dictionary with extracted data.
"""
with open("README.md", "r", encoding="utf-8") as file:
readme_content = file.read()

Expand All @@ -25,8 +30,15 @@ async def decompile_readme():


async def build_readme(translated_chunks, data):
"""
Rebuild the translated chunks into a complete translated README content.
:param translated_chunks: List of translated text chunks.
:param data: Dictionary containing extracted data like code blocks, links, and HTML tags.
:return: Translated README content.
"""
translated_content = " ".join(translated_chunks)
print("馃摝 Let's start collecting the translation.")
print("馃摝 Let's start building the translation.")

for i, code_block in enumerate(data["code_blocks"]):
translated_content = translated_content.replace(f"10001", code_block, 1)
Expand All @@ -41,6 +53,11 @@ async def build_readme(translated_chunks, data):


async def update_localizations():
"""
Update the localizations for the specified languages.
:return: updated files
"""
every = await decompile_readme()
chunks = every[0]
data = every[1]
Expand Down

0 comments on commit 07ca24b

Please sign in to comment.