Add 72 Rules of St. Benedict translations for all 27 languages
- rules_benedict.py: Source translations for all 72 rules in 27 languages - inject_rules.py: Script to inject rules into i18n.py TRANSLATIONS - i18n.py: Added rule_1..rule_72 for all language dicts - about.html.j2: Fixed HTML escaping with |safe filter for rules
This commit is contained in:
parent
5877c950dc
commit
3303554a8a
4 changed files with 4099 additions and 103 deletions
70
inject_rules.py
Normal file
70
inject_rules.py
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Inject Benedict rules from rules_benedict.py into i18n.py."""
|
||||
|
||||
import re
|
||||
|
||||
def inject_rules():
|
||||
# Import rules
|
||||
from rules_benedict import RULES
|
||||
|
||||
# Read current i18n.py
|
||||
with open("i18n.py", "r") as f:
|
||||
content = f.read()
|
||||
|
||||
# For each language in RULES, add the rules to the corresponding language in TRANSLATIONS
|
||||
for lang, rules in RULES.items():
|
||||
if lang == "en":
|
||||
continue # Already added
|
||||
|
||||
print(f"Processing {lang}...")
|
||||
|
||||
# Find the language dict in i18n.py
|
||||
lang_pattern = f'"{lang}": {{'
|
||||
lang_start = content.find(lang_pattern)
|
||||
if lang_start == -1:
|
||||
print(f" Could not find '{lang}' in i18n.py")
|
||||
continue
|
||||
|
||||
# Find the closing of this language dict
|
||||
brace_count = 0
|
||||
pos = lang_start
|
||||
in_lang = False
|
||||
insert_pos = None
|
||||
for i, ch in enumerate(content[lang_start:]):
|
||||
if ch == '{':
|
||||
brace_count += 1
|
||||
in_lang = True
|
||||
elif ch == '}':
|
||||
brace_count -= 1
|
||||
if brace_count == 0 and in_lang:
|
||||
insert_pos = lang_start + i
|
||||
break
|
||||
|
||||
if insert_pos is None:
|
||||
print(f" Could not find end of '{lang}' dict")
|
||||
continue
|
||||
|
||||
# Check if rules already exist
|
||||
if f'"rule_1":' in content[lang_start:insert_pos]:
|
||||
print(f" Rules already exist for {lang}, skipping")
|
||||
continue
|
||||
|
||||
# Generate rules string
|
||||
rules_str = ""
|
||||
for key, value in rules.items():
|
||||
# Escape quotes in value
|
||||
escaped = value.replace('\\', '\\\\').replace('"', '\\"')
|
||||
rules_str += f' "{key}": "{escaped}",\n'
|
||||
|
||||
# Insert before the closing }
|
||||
content = content[:insert_pos] + rules_str + content[insert_pos:]
|
||||
print(f" Added {len(rules)} rules")
|
||||
|
||||
# Write updated content
|
||||
with open("i18n.py", "w") as f:
|
||||
f.write(content)
|
||||
|
||||
print("Done!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
inject_rules()
|
||||
2051
rules_benedict.py
Normal file
2051
rules_benedict.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -638,86 +638,17 @@
|
|||
<div class="chapter-content">
|
||||
<h2 class="chapter-title">{{ t.about_ch10_title }}</h2>
|
||||
|
||||
<p class="narrative">{{ t.about_ch10_p1 }}</p>
|
||||
<p class="narrative">{{ t.about_ch10_p1|safe }}</p>
|
||||
|
||||
<p class="narrative">{{ t.about_ch10_p2 }}</p>
|
||||
|
||||
<div class="rule-grid">
|
||||
<div class="rule-item"><strong>1.</strong> Love the Lord God with your whole heart, soul, and strength.</div>
|
||||
<div class="rule-item"><strong>2.</strong> Love your neighbor as yourself.</div>
|
||||
<div class="rule-item"><strong>3.</strong> Do not murder.</div>
|
||||
<div class="rule-item"><strong>4.</strong> Do not commit adultery.</div>
|
||||
<div class="rule-item"><strong>5.</strong> Do not steal.</div>
|
||||
<div class="rule-item"><strong>6.</strong> Do not covet.</div>
|
||||
<div class="rule-item"><strong>7.</strong> Do not bear false witness.</div>
|
||||
<div class="rule-item"><strong>8.</strong> Honor all people.</div>
|
||||
<div class="rule-item"><strong>9.</strong> Do not do to another what you would not have done to yourself.</div>
|
||||
<div class="rule-item"><strong>10.</strong> Deny oneself in order to follow Christ.</div>
|
||||
<div class="rule-item"><strong>11.</strong> Chastise the body.</div>
|
||||
<div class="rule-item"><strong>12.</strong> Do not become attached to pleasures.</div>
|
||||
<div class="rule-item"><strong>13.</strong> Love fasting.</div>
|
||||
<div class="rule-item"><strong>14.</strong> Relieve the poor.</div>
|
||||
<div class="rule-item"><strong>15.</strong> Clothe the naked.</div>
|
||||
<div class="rule-item"><strong>16.</strong> Visit the sick.</div>
|
||||
<div class="rule-item"><strong>17.</strong> Bury the dead.</div>
|
||||
<div class="rule-item"><strong>18.</strong> Be a help in times of trouble.</div>
|
||||
<div class="rule-item"><strong>19.</strong> Console the sorrowing.</div>
|
||||
<div class="rule-item"><strong>20.</strong> Be a stranger to the world's ways.</div>
|
||||
<div class="rule-item"><strong>21.</strong> Prefer nothing more than the love of Christ.</div>
|
||||
<div class="rule-item"><strong>22.</strong> Do not give way to anger.</div>
|
||||
<div class="rule-item"><strong>23.</strong> Do not nurse a grudge.</div>
|
||||
<div class="rule-item"><strong>24.</strong> Do not entertain deceit in your heart.</div>
|
||||
<div class="rule-item"><strong>25.</strong> Do not give a false peace.</div>
|
||||
<div class="rule-item"><strong>26.</strong> Do not forsake charity.</div>
|
||||
<div class="rule-item"><strong>27.</strong> Do not swear, for fear of perjuring yourself.</div>
|
||||
<div class="rule-item"><strong>28.</strong> Utter only truth from heart and mouth.</div>
|
||||
<div class="rule-item"><strong>29.</strong> Do not return evil for evil.</div>
|
||||
<div class="rule-item"><strong>30.</strong> Do no wrong to anyone, and bear patiently wrongs done to yourself.</div>
|
||||
<div class="rule-item"><strong>31.</strong> Love your enemies.</div>
|
||||
<div class="rule-item"><strong>32.</strong> Do not curse those who curse you, but rather bless them.</div>
|
||||
<div class="rule-item"><strong>33.</strong> Bear persecution for justice's sake.</div>
|
||||
<div class="rule-item"><strong>34.</strong> Be not proud.</div>
|
||||
<div class="rule-item"><strong>35.</strong> Be not addicted to wine.</div>
|
||||
<div class="rule-item"><strong>36.</strong> Be not a great eater.</div>
|
||||
<div class="rule-item"><strong>37.</strong> Be not drowsy.</div>
|
||||
<div class="rule-item"><strong>38.</strong> Be not lazy.</div>
|
||||
<div class="rule-item"><strong>39.</strong> Be not a grumbler.</div>
|
||||
<div class="rule-item"><strong>40.</strong> Be not a detractor.</div>
|
||||
<div class="rule-item"><strong>41.</strong> Put your hope in God.</div>
|
||||
<div class="rule-item"><strong>42.</strong> Attribute to God, and not to self, whatever good you see in yourself.</div>
|
||||
<div class="rule-item"><strong>43.</strong> Recognize always that evil is your own doing, and to impute it to yourself.</div>
|
||||
<div class="rule-item"><strong>44.</strong> Fear the Day of Judgment.</div>
|
||||
<div class="rule-item"><strong>45.</strong> Be in dread of hell.</div>
|
||||
<div class="rule-item"><strong>46.</strong> Desire eternal life with all the passion of the spirit.</div>
|
||||
<div class="rule-item"><strong>47.</strong> Keep death daily before your eyes.</div>
|
||||
<div class="rule-item"><strong>48.</strong> Keep constant guard over the actions of your life.</div>
|
||||
<div class="rule-item"><strong>49.</strong> Know for certain that God sees you everywhere.</div>
|
||||
<div class="rule-item"><strong>50.</strong> When wrongful thoughts come into your heart, dash them against Christ immediately.</div>
|
||||
<div class="rule-item"><strong>51.</strong> Disclose wrongful thoughts to your spiritual mentor.</div>
|
||||
<div class="rule-item"><strong>52.</strong> Guard your tongue against evil and depraved speech.</div>
|
||||
<div class="rule-item"><strong>53.</strong> Do not love much talking.</div>
|
||||
<div class="rule-item"><strong>54.</strong> Speak no useless words or words that move to laughter.</div>
|
||||
<div class="rule-item"><strong>55.</strong> Do not love much or boisterous laughter.</div>
|
||||
<div class="rule-item"><strong>56.</strong> Listen willingly to holy reading.</div>
|
||||
<div class="rule-item"><strong>57.</strong> Devote yourself frequently to prayer.</div>
|
||||
<div class="rule-item"><strong>58.</strong> Daily in your prayers, with tears and sighs, confess your past sins to God, and amend them for the future.</div>
|
||||
<div class="rule-item"><strong>59.</strong> Fulfill not the desires of the flesh; hate your own will.</div>
|
||||
<div class="rule-item"><strong>60.</strong> Obey in all things the commands of those whom God has placed in authority over you even though they should act otherwise, mindful of the Lord's precept, "Do what they say, but not what they do."</div>
|
||||
<div class="rule-item"><strong>61.</strong> Do not wish to be called holy before one is holy; but first to be holy, that you may be truly so called.</div>
|
||||
<div class="rule-item"><strong>62.</strong> Fulfill God's commandments daily in your deeds.</div>
|
||||
<div class="rule-item"><strong>63.</strong> Love chastity.</div>
|
||||
<div class="rule-item"><strong>64.</strong> Hate no one.</div>
|
||||
<div class="rule-item"><strong>65.</strong> Be not jealous, nor harbor envy.</div>
|
||||
<div class="rule-item"><strong>66.</strong> Do not love quarreling.</div>
|
||||
<div class="rule-item"><strong>67.</strong> Shun arrogance.</div>
|
||||
<div class="rule-item"><strong>68.</strong> Respect your seniors.</div>
|
||||
<div class="rule-item"><strong>69.</strong> Love your juniors.</div>
|
||||
<div class="rule-item"><strong>70.</strong> Pray for your enemies in the love of Christ.</div>
|
||||
<div class="rule-item"><strong>71.</strong> Make peace with your adversary before the sun sets.</div>
|
||||
<div class="rule-item"><strong>72.</strong> Never despair of God's mercy.</div>
|
||||
{% for i in range(1, 73) %}
|
||||
<div class="rule-item"><strong>{{ i }}.</strong> {{ t['rule_' ~ i] }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<p class="narrative" style="margin-top: 60px;">{{ t.about_ch10_p3 }}</p>
|
||||
<p class="narrative" style="margin-top: 60px;">{{ t.about_ch10_p3|safe }}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
@ -732,7 +663,7 @@
|
|||
python neopig.py --serve</code></pre>
|
||||
</div>
|
||||
|
||||
<p class="narrative">{{ t.about_ch11_p1 }}</p>
|
||||
<p class="narrative">{{ t.about_ch11_p1|safe }}</p>
|
||||
|
||||
<p class="narrative">{{ t.about_ch11_p2 }}</p>
|
||||
</div>
|
||||
|
|
@ -746,7 +677,7 @@ python neopig.py --serve</code></pre>
|
|||
<a href="https://git.unturf.com/engineering/unturf/pig.py" target="_blank">git.unturf.com/engineering/unturf/pig.py</a>
|
||||
<p style="margin-top: 40px; color: #444; font-size: 0.9em;">
|
||||
{{ t.about_footer_p3 }}<br>
|
||||
{{ t.about_footer_remember }}
|
||||
{{ t.about_footer_remember|safe }}
|
||||
</p>
|
||||
<a href="https://media.unturf.com/c/28697a5a-b2ad-11ec-9431-eb3419618d4a/oven-fresh-internet-4-all" target="_blank"><img src="/static/images/oven-fresh-internet.jpg" alt="Oven fresh internet" style="width:21%"></a>
|
||||
<p style="margin-top: 60px; color: #666;">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue