Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from tematim/master
Browse files Browse the repository at this point in the history
Update from master branch
  • Loading branch information
tematim committed Jun 23, 2020
2 parents 4b368a1 + 0a4f5d0 commit 37b2826
Show file tree
Hide file tree
Showing 22 changed files with 111 additions and 80 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
11 changes: 0 additions & 11 deletions .github/workflows/lint.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Validate translation files
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Validate
run: ./validate_yaml.py
13 changes: 0 additions & 13 deletions .yamllint

This file was deleted.

5 changes: 1 addition & 4 deletions Localization/de-DE/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/en-US/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

11 changes: 11 additions & 0 deletions Localization/en-US/faq.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
url: "https://foldingathome.org/support/faq/"
language: "en-US"
title: "FAQ"
text: [
# Bold paragraph
"You’ll find a large library of frequently asked questions about all things connected to Folding@home.",

# The rest of the paragraph
"This section contains everything from guides and information about how to install and use the Folding@home software to the science behind our research. Look through the sidebar and find the topic you want to know more about."
]
1 change: 1 addition & 0 deletions Localization/en-US/home.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
url: "https://foldingathome.org/"
title: "Folding@home"
language: "en-US"
text: [
# I AM One IN A MILLION bold text
Expand Down
5 changes: 1 addition & 4 deletions Localization/es-ES/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/fr-FR/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

7 changes: 3 additions & 4 deletions Localization/fr-FR/about.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
url: "https://foldingathome.org/about/"
language: "fr-FR"
title: "A propos"
title: "À propos"
text: [
# Bold text at the start
"Folding @ home (FAH or F @ h)",
"Folding@home (FAH ou F@H)",

# The rest of the paragraph
# "is a distributed computing project for simulating protein dynamics, including the process of protein folding and the movements of proteins implicated in a variety of diseases. It brings together citizen scientists who volunteer to run simulations of protein dynamics on their personal computers. Insights from this data are helping scientists to better understand biology, and providing new opportunities for developing therapeutics. "
"Folding@home (FAH ou F@h) est un projet de calcul distribué qui simule des protéines dynamiques, incluant le processus de repliement de protéines ainsi que le mouvement de protéines impliquées dans de nombreuses maladies. Ce projet rassemble des citoyens scientifiques bénévoles qui exécute des simulations de protéines dynamiques sur leurs ordinateurs personnels. Les perspectives de ces données sont d'aider les scientifiques à mieux comprendre la biologie et de leur donner des opportunités de développer des nouveaux traitements."
"est un projet de calcul distribué qui simule la dynamique des protéines, y compris leur processus de repliement et leurs mouvements, des phénomènes impliqués dans de nombreuses maladies. Ce projet réunit des « citoyens scientifiques » bénévoles qui exécutent de telles simulations sur leur ordinateur personnel. Les enseignements ainsi obtenus aident les scientifiques à mieux comprendre la biologie en présence et leur permettent de développer de nouveaux traitements."
]
5 changes: 1 addition & 4 deletions Localization/it-IT/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/ja-JP/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/ko-KR/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

1 change: 1 addition & 0 deletions Localization/ko-KR/home.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
url: "https://foldingathome.org/"
title: "Folding@home"
language: "ko-KR"
text: [
# I AM One IN A MILLION bold text
Expand Down
5 changes: 1 addition & 4 deletions Localization/nl-NL/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/pt-PT/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/ru-RU/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/sk-SK/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/sv-SE/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 1 addition & 4 deletions Localization/zh-CN/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

58 changes: 58 additions & 0 deletions validate_yaml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python3

import fnmatch
import yaml
import traceback
import os


def find(pattern, path):
result = []
for root, dirs, files in os.walk(path):
for name in files:
if fnmatch.fnmatch(name, pattern):
result.append(os.path.join(root, name))
return result


# eg: Localization/en-US/statistics.yaml
def path_to_language(file):
(head, tail) = os.path.split(file)
(head, tail) = os.path.split(head)
return tail


def filename_is(path, filename):
(head, tail) = os.path.split(path)
return tail == filename


def ensure_schema(translation, path):
keys = ["url", "language", "text", "title"]

for key in keys:
if key not in translation:
raise Exception("Missing '%s' key in %s" % (key, path))


def ensure_language(translation, path):
expected_language = path_to_language(path)
if translation["language"] != expected_language:
raise Exception(
"%s was expected to be in language %s, but instead was %s" %
(path, expected_language, translation["language"]))


exit_code = 0
for path in find("*.yaml", "Localization"):
with open(path) as f:
print("Validating", path)
try:
translation = yaml.safe_load(f)
ensure_schema(translation, path)
ensure_language(translation, path)
except Exception as e:
exit_code = 1
traceback.print_exc()

exit(exit_code)

0 comments on commit 37b2826

Please sign in to comment.