Should strings from news section be translated?
The news section contains mostly commit messages in the monthly newsletters, it also doesn't seem like a useful effort to translate those as the benefit is rather minimal.
We should find a strategy to remove the posts from the news section when running gettext to avoid that the strings appear in the translation in the first place. A quick hack might be adding a tag like shown here
diff --git a/intl.py b/intl.py
index 74d6da866..f9f8f4dba 100644
--- a/intl.py
+++ b/intl.py
@@ -56,7 +56,7 @@ def intl_gettext() -> None:
"""
subprocess.run(
- ["sphinx-build", "-b", "gettext", srcdir, outdir],
+ ["sphinx-build", "-b", "gettext", "-t", "gettext", srcdir, outdir],
cwd=root,
check=True,
)
diff --git a/source/conf.py b/source/conf.py
index 60a06560b..2abc5bbf9 100644
--- a/source/conf.py
+++ b/source/conf.py
@@ -186,6 +186,9 @@ html_sidebars = {
}
html_title = "Fortran Programming Language"
html_logo = "_static/images/fortran-logo-256x256.png"
+exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
+if tags.has("gettext"):
+ exclude_patterns.append("news/**")
master_doc = "index"
However, it would be better to just check which builder is currently used and add the required exclude pattern based on this information. Localized news are probably better provided by having multiple language specific news sections, maybe with the English plus local one being displayed on the webpage.
@awvwgk Sir, This would Exclude them from build thus would break the links in the translated pages. We would have to find a way to not generate the po files for news section or to disable the language translations in ablog.
Just checked and it looks okay, the change should only affect the string extraction but not the actual build of the page. Not having the strings in the translation file should be identical to having no translation, i.e. falling back to English.
@awvwgk yes sir, I had confused it with the conf.py file . it works great with the intl.py file. Thanks Sir.