Skip to content

Commit

Permalink
Merge branch 'main' into title-css
Browse files Browse the repository at this point in the history
  • Loading branch information
teolemon authored Nov 15, 2023
2 parents 012bd0a + 5aac78a commit ca8563b
Show file tree
Hide file tree
Showing 7,363 changed files with 228,596 additions and 72,181 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
96 changes: 63 additions & 33 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,96 @@
github_actions:
- .github/**/*

crowdin:
Crowdin:
- crowdin.yml

ecoscore:
🧴 Open Beauty Facts:
- lang/obf/**/*

🍊 Open Food Facts:
- lang/en/texts/mobileapp/features/fooddecyphering.html

🐾 Open Pet Food Facts:
- lang/opff/**/*

📸 Open Products Facts:
- lang/opf/**/*

Eco-Score:
- lang/en/texts/ecoscore/**/*
- lang/en/texts/eco-score-the-environmental-impact-of-food-products.html
- lang/en/texts/ecoscore-computation.html

presskit-ecoscore:
🗞️ Press - Presskit Eco-Score:
- lang/en/texts/presskit-ecoscore.html

nutriscore:
🚥 Nutri-Score:
- lang/en/texts/nutriscore/**/*
- lang/en/texts/open-food-facts-and-the-nutriscore.html
- lang/en/texts/nutriscore-formula.html
- lang/en/texts/nutriscore.html

roadmap2019-roadmap:
- lang/en/texts/2019-roadmap.html
advanced-user-guide:

Advanced user guide:
- lang/en/texts/advanced-user-guide.html
better-food-choices-for-a-better-health-lets-mobilize:
- lang/en/texts/better-food-choices-for-a-better-health-lets-mobilize.html
code-of-conduct:
Code of conduct:
- lang/en/texts/code-of-conduct.html
contact:

Contact page:
- lang/en/texts/contact.html
contacts:

Press - contacts:
- lang/en/texts/contacts.html
contribute-to-open-food-facts-by-playing:
- lang/en/texts/contribute-to-open-food-facts-by-playing.html

contribute:
- lang/en/texts/contribute.html

cop-26:
- lang/en/texts/cop26/**/*

data:
- lang/en/texts/data.html
dev-page:

👩‍💻 Developers:
- lang/en/texts/dev-android.html
- lang/en/texts/dev-artificial-intelligence.html
- lang/en/texts/dev-emerging.html
- lang/en/texts/dev-general.html
- lang/en/texts/dev-ios.html
- lang/en/texts/dev-server.html
- lang/en/texts/development.html

discover:
- lang/en/texts/discover.html
donate:
🎁 Donations:
- lang/en/texts/donate.html
education:
- lang/en/texts/education.html
experimental-nutrition-score-france:

🚥 Experimental nutrition score france:
- lang/en/texts/experimental-nutrition-score-france.html
faq:

❓ FAQ:
- lang/en/texts/faq.html

feuille-de-route-2012:
- lang/en/texts/feuille-de-route-2012.html

google-impact-challenge-on-climate:
- lang/en/texts/google-impact-challenge-on-climate.html

google-summer-of-code:
- lang/en/texts/google-summer-of-code.html

graphs-in-3-clicks:
- lang/en/texts/graphs-in-3-clicks.html

help-complete-products:
- lang/en/texts/help-complete-products.html
help-us-fill-up-on-fiber:
Expand All @@ -71,32 +99,33 @@ how-to-add-a-product:
- lang/en/texts/how-to-add-a-product.html
how-to-complete-products-on-android:
- lang/en/texts/how-to-complete-products-on-android.html
index-pro:
🏭 Producers - Index Pro:
- lang/en/texts/index-pro.html
index:
- lang/en/texts/index.html
ingredient-detector:
- lang/en/texts/ingredient-detector.html
iphone:
🍎 iPhone:
- lang/en/texts/iphone.html
keyfacts:
🗞️ Press - keyfacts:
- lang/en/texts/keyfacts.html
legal:
- lang/en/texts/legal.html
logo-obf:
🧴 Logo Open Beauty Facts:
- lang/en/texts/logo-obf.html
logo:
🍊 Logo Open Food Facts:
- lang/en/texts/logo.html
missions-texts:
- lang/en/texts/missions-texts.html
missions:
- lang/en/texts/missions.html
mobile-app-open-food-facts:
🤳🥫 Mobile app - Open Food Facts:
- lang/en/texts/mobile-app-open-food-facts.html
nova:

Nova:
- lang/en/texts/nova.html
- lang/en/texts/processing/**/*
numbers-selected:
🗞️ Press - numbers-selected:
- lang/en/texts/numbers-selected.html
nutrients-list:
- lang/en/texts/nutrients-list.html
Expand All @@ -112,17 +141,17 @@ open-food-hunt-2015:
- lang/en/texts/open-food-hunt-2015.html
operation-sodas:
- lang/en/texts/operation-sodas.html
partners:
🤝 Partners:
- lang/en/texts/partners.html
presentations:
- lang/en/texts/presentations.html
press-and-blogs:
🗞️ Press and blogs:
- lang/en/texts/press-and-blogs.html
press-old:
🗞️ Press old:
- lang/en/texts/press-old.html
press:
🗞️ Press:
- lang/en/texts/press.html
presskit_country_selection:
🗞️ Presskit - Country Selection:
- lang/en/texts/presskit_de_CH_selection.html
- lang/en/texts/presskit_de_DE_selection.html
- lang/en/texts/presskit_en_AU_selection.html
Expand All @@ -139,27 +168,28 @@ presskit_country_selection:
- lang/en/texts/presskit_pt_PT_selection.html
- lang/en/texts/presskit_selection.html
- lang/en/texts/presskit_vi_VI_selection.html
producers:

🏭 Producers:
- lang/en/texts/producers.html
product-preferences:
- lang/en/texts/product-preferences.html
products:
- lang/en/texts/products.html
rate-your-vending-machine:
Rate your vending machine:
- lang/en/texts/rateyourvendingmachine.html
scan-parties:
Scan parties:
- lang/en/texts/scan-parties.html
science:
Science:
- lang/en/texts/science.html
sendinblue:
📨 Brevo:
- lang/en/texts/sendinblue.html
Smoothie:
- lang/en/texts/smoothie/**/*
sugar:
🍬 Sugar:
- lang/en/texts/sugar.html
terms-of-use:
terms of use:
- lang/en/texts/terms-of-use.html
update-a-product-from-the-mobile-app:
- lang/en/texts/update-a-product-from-the-mobile-app.html
who-we-are:
Who we are:
- lang/en/texts/who-we-are.html
57 changes: 57 additions & 0 deletions .github/scripts/check_includes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from bs4 import BeautifulSoup
import glob
import os
import sys

def extract_includes(file_path):
includes = set()
with open(file_path, 'r') as f:
soup = BeautifulSoup(f, 'html.parser')
includes_elements = soup.find_all(string=lambda text: '[[texts/' in text)
for include in includes_elements:
includes.add(include.strip())
return includes

def main():
# Get list of English HTML files
en_files = glob.glob('lang/en/texts/**/*.html', recursive=True)

all_good = True

# Get list of all language directories
lang_dirs = glob.glob('lang/*/')

for en_file_path in en_files:
# Extract the original includes from the English version
original_includes = extract_includes(en_file_path)

for lang_dir in lang_dirs:
lang = os.path.basename(os.path.normpath(lang_dir))

# Skip the English directory
if lang == 'en':
continue

# Generate the corresponding path for the translated version
translated_file_path = en_file_path.replace('lang/en/', f'lang/{lang}/')

# Skip if the translated file does not exist
if not os.path.exists(translated_file_path):
print(f"Warning: Translated file does not exist for language '{lang}' - {translated_file_path}")
continue

# Extract includes from the translated version
translated_includes = extract_includes(translated_file_path)

# Check if original includes are preserved in the translated version
for original_include in original_includes:
if original_include not in translated_includes:
print(f"Error: Missing include in language '{lang}', file {translated_file_path}: {original_include}")
all_good = False

if not all_good:
print("Error: Missing includes found in one or more files across languages.")
sys.exit(1)

if __name__ == "__main__":
main()
6 changes: 5 additions & 1 deletion .github/workflows/auto-assign-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ name: 'Auto Author Assign'
on:
pull_request_target:
types: [opened, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write
Expand All @@ -12,4 +16,4 @@ jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/auto-author-assign@v1.6.1
- uses: toshimaru/auto-author-assign@v2.0.1
27 changes: 27 additions & 0 deletions .github/workflows/check_includes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check Includes in HTML Templates

on:
push:
paths:
- 'impossiblecondition**.html'
pull_request:
paths:
- 'impossiblecondition**.html'

jobs:
check-includes:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Dependencies
run: pip install beautifulsoup4

- name: Check for Translated Includes
run: python .github/scripts/check_includes.py
35 changes: 35 additions & 0 deletions .github/workflows/check_strings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check Forbidden Strings in index.html

on:
push:
paths:
- 'lang/**/texts/index.html'
pull_request:
paths:
- 'lang/**/texts/index.html'

jobs:
check_strings:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install prerequisites
run: sudo apt-get install -y grep

- name: Check for forbidden strings
run: |
FORBIDDEN_STRINGS=("Open Pet Food Facts" "Open Beauty Facts" "Open Products Facts")
FILES=$(find ./lang/ -name 'index.html' -path '*/texts/*')
for file in $FILES; do
for string in "${FORBIDDEN_STRINGS[@]}"; do
if grep -q "$string" "$file"; then
echo "Error: '$string' found in $file"
exit 1
fi
done
done
echo "No forbidden strings found."
4 changes: 2 additions & 2 deletions .github/workflows/crowdin-per-language.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
lc: [zh-CN,it, es, fr, de, id, en,he,da,ko,nl,pt-BR,zh-TW,nl-BE,pt-PT,nl,zh-HK,zh-CN, aa , ar , ber , br , co , fa , ga , hy , iu , kk , lb , me , mr , ne , no , ry , sd , sl , sq , st , tg , tr , tzl , val , wa , zea , zu , ach , as , bg , bs , crs , eo , fi , gd , hi , id , ja , km , ku , lo , mg , ms , nr , pa , qu , sa , sg , sma , sr , sv , th , ts , ug , ve , wo , zh ,af , ast , bm , ca , cs , el , fil , gl , hr , ii , jv , kmr , kw , mi , mt , pl , rm , sat , sh , sn , sr_CS , sw , ti , tt , uk , vec , xh , ak , az , bn , ce , cv , et , fo , gu , ht , is , ka , kmr_TR , ky , lt , ml , my , oc , ro , sc , si , so , sr_RS , ta , tl , tw , ur , vi , yi , am , be , bo , chr , cy , eu , ha , hu , kab , kn , la , lv , mn , nb , nn , ru , sco , sk , son , ss , te , tn , ty , uz , vls , yo ]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Matrix
uses: crowdin/github-action@1.5.0
uses: crowdin/github-action@v1.15.1
with:
upload_translations: false # default is false
download_translations: true
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ on:
push:
branches:
- crowdin-trigger
schedule:
- cron: "0 7 * * *"
jobs:
synchronize-with-crowdin-classic:
name: Synchronize with crowdin
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: crowdin action
uses: crowdin/github-action@1.5.0
uses: crowdin/github-action@v1.15.1
with:
upload_translations: false # default is false
# Use this option to upload translations for a single specified language
Expand Down Expand Up @@ -48,7 +46,8 @@ jobs:
# The title of the new pull request
pull_request_title: "chore: New Crowdin translations to review and merge"
# The contents of the pull request
# pull_request_body: # optional
pull_request_body: '### What\n- Automated pull request pulling in new or updated translations from Crowdin (https://translate.openfoodfacts.org).\n## Checklist\n- [ ] Check that they are no bad translations. If there are, correct them directly in Crowdin so that they are not resynced again. Then you can correct them here as well, or wait 24 hours for the sync to happen automatically.\n- [ ] Put extra attention on Acholi, which is used mistakenly as a sandbox by people discovering the self-service translation button on Open Food Facts\n- [ ] Once you are happy, that automated checks pass, you can approve the PR and merge it.\n### Part of\n- Translations'
# The contents of the pull request
# To add labels for created pull request
pull_request_labels: "translations"
# Create pull request to specified branch instead of default one
Expand Down
Loading

0 comments on commit ca8563b

Please sign in to comment.