Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should strings from news section be translated? #173

Open
awvwgk opened this issue Oct 1, 2022 · 3 comments
Open

Should strings from news section be translated? #173

awvwgk opened this issue Oct 1, 2022 · 3 comments
Labels
i18n Localisation and internationalisation of the webpage section: news Relevant for the news section on the webpage

Comments

@awvwgk
Copy link
Member

awvwgk commented Oct 1, 2022

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 awvwgk added i18n Localisation and internationalisation of the webpage section: news Relevant for the news section on the webpage labels Oct 1, 2022
@henilp105
Copy link
Member

@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.

@awvwgk
Copy link
Member Author

awvwgk commented Oct 1, 2022

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.

@henilp105
Copy link
Member

@awvwgk yes sir, I had confused it with the conf.py file . it works great with the intl.py file. Thanks Sir.

@awvwgk awvwgk changed the title Should strings from news section be translated Should strings from news section be translated? Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Localisation and internationalisation of the webpage section: news Relevant for the news section on the webpage
Projects
None yet
Development

No branches or pull requests

2 participants