Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 13, 2024
1 parent 9693674 commit c8684e8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ jobs:
tar -xvzf tx-linux-amd64.tar.gz
- name: Configure Transifex
run: |
python ./utils/transifex_utils.py
run: scripts/transifex_utils.py
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}

Expand Down
48 changes: 48 additions & 0 deletions website/.tx/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,50 @@
[main]
host = https://www.transifex.com

[o::p::r:tx_slug: documentation_desktop]
file_filter = documentation/desktop.<lang>.md
source_file = documentation/desktop.fr.md
source_lang = fr
type = GITHUBMARKDOWN

[o::p::r:tx_slug: documentation_roadmap]
file_filter = documentation/roadmap.<lang>.md
source_file = documentation/roadmap.fr.md
source_lang = fr
type = GITHUBMARKDOWN

[o::p::r:tx_slug: documentation_mobile]
file_filter = documentation/mobile.<lang>.md
source_file = documentation/mobile.fr.md
source_lang = fr
type = GITHUBMARKDOWN

[o::p::r:tx_slug: documentation_installation]
file_filter = documentation/installation.<lang>.md
source_file = documentation/installation.fr.md
source_lang = fr
type = GITHUBMARKDOWN

[o::p::r:tx_slug: documentation_home]
file_filter = documentation/index.<lang>.md
source_file = documentation/index.fr.md
source_lang = fr
type = GITHUBMARKDOWN

[o::p::r:tx_slug: documentation_datamodel-doc]
file_filter = documentation/datamodel-doc.<lang>.md
source_file = documentation/datamodel-doc.fr.md
source_lang = fr
type = GITHUBMARKDOWN

[o::p::r:tx_slug: documentation_data-model]
file_filter = documentation/data-model.<lang>.md
source_file = documentation/data-model.fr.md
source_lang = fr
type = GITHUBMARKDOWN

[o::p::r:tx_slug: documentation_contribute]
file_filter = documentation/contribute.<lang>.md
source_file = documentation/contribute.fr.md
source_lang = fr
type = GITHUBMARKDOWN
2 changes: 0 additions & 2 deletions website/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ mkdocs-material==9.5.9
mkdocs-video==1.5.0
mkdocs-static-i18n @ git+https://github.com/kamilkrzyskow/i18n.git@5de82f096531adfaf7990da89002fe6cb207ca7a
fancyboxmd==1.1.0
python-dotenv==1.0.1
python-frontmatter==3.0.7
22 changes: 16 additions & 6 deletions website/utils/transifex_utils.py → website/scripts/transifex_utils.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python3

import glob
import os
import re

import frontmatter

TX_ORGANIZATION = "opengisch"
TX_PROJECT = "signalo-website"
TX_ORGANIZATION = ""
TX_PROJECT = ""
TX_SOURCE_LANG = "fr"
TX_TYPE = "GITHUBMARKDOWN"

Expand All @@ -30,9 +31,18 @@ def create_transifex_config():
# Get relative path of file
relative_path = os.path.relpath(file, start=root)

tx_slug = frontmatter.load(file).get("tx_slug", None)
tx_slugs = [re.match(r"^tx_slug: (.*)", line) for line in open(file)]
tx_slugs = [t for t in tx_slugs if t]

if not tx_slugs:
print(f"No TX slug found for {relative_path}")

if len(tx_slugs) > 1:
print(f"More than 1 TX slug found for {relative_path}")

if tx_slug:
if tx_slugs:
print(tx_slugs)
tx_slug = tx_slugs[0].group(0)
print(f"Found file with tx_slug defined: {relative_path}, {tx_slug}")
f.write(f"[o:{TX_ORGANIZATION}:p:{TX_PROJECT}:r:{tx_slug}]\n")
f.write(
Expand Down

0 comments on commit c8684e8

Please sign in to comment.