From d2505b23e095ab8a30696a39b66df9862114be40 Mon Sep 17 00:00:00 2001 From: Jan Kuparinen Date: Jan 14 2021 08:10:42 +0000 Subject: [PATCH 1/4] Translation flow documented --- diff --git a/modules/ROOT/pages/translation-flow.adoc b/modules/ROOT/pages/translation-flow.adoc new file mode 100644 index 0000000..bf038f6 --- /dev/null +++ b/modules/ROOT/pages/translation-flow.adoc @@ -0,0 +1,87 @@ += Translation flow (for Fedora websites) + Jan Kuparinen +:page-authors: {author} + +== General + +Fedora websites can be viewed in many languages. This page gives some details on how this happens. + +=== Tagging text + +System needs to be told what strings needs to be translated. +Generally every text inside web page should be surrounded with tags: + +[source,html] +---- +{% trans trimmed %}Translate this text.{% endtrans %} +---- + + + + + +== Generating po file +First we need to pull all translatable strings into a file called getfedora.org.pot + +This file is generated by running: + +[source,bash] +---- +podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/translations-source.sh +---- + +This file needs to be sent to link:++https://pagure.io/fedora-web/translations++[translations repository] + +If you don't have access to the translations repository push it to fedora-websites and is should be automatically sent to translations repository with 24 hours. + +== Weblate process (How strings get translated) + +Once getfedora.org.pot file is in the translations repository it will be pulled by Weblate system and merged into translatable strings. It can then be translated by translators. + +== Manual testing +[NOTE] +==== +Any translations made here will not get propagated to the weblate of final versions of the page. +==== +You can test the changes manually by: + +1) +Update strings to the language files +[source,bash] +---- +podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/translations-update-local.sh +---- + +Now edit desired language file, for example + +[source,bash] +---- +nano sites/getfedora.org/translations/fi/LC_MESSAGES/messages.po +---- +Find the string you want to test, format inside file is: + + `#: partials/templates/download_card.html:13` Location(s) of string. + `msgid "Download"` Text in english. + `msgstr "Lataa"` Text in desired language. + + +Edit the `msgstr` + +Once edited translations need to be combiled into more efficient format for the web server. This is done by running: + +[source,bash] +---- +podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/translations-update-local.sh +---- + + + +==== Description of translation scripts inside sites/getfedora.org/scripts + +[NOTE] +==== +Technically scripts can be run without using podman, but will then require proper setup in the local machine. The instructions given above are safer for generic users. +==== + + + From f8ee3318048af6c38e586c13812082a179064f9d Mon Sep 17 00:00:00 2001 From: Jan Kuparinen Date: Jan 14 2021 08:25:12 +0000 Subject: [PATCH 2/4] saved again --- diff --git a/modules/ROOT/pages/translation-flow.adoc b/modules/ROOT/pages/translation-flow.adoc index bf038f6..d126514 100644 --- a/modules/ROOT/pages/translation-flow.adoc +++ b/modules/ROOT/pages/translation-flow.adoc @@ -16,11 +16,7 @@ Generally every text inside web page should be surrounded with tags: {% trans trimmed %}Translate this text.{% endtrans %} ---- - - - - -== Generating po file +== Generating pot file First we need to pull all translatable strings into a file called getfedora.org.pot This file is generated by running: @@ -32,7 +28,7 @@ podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/translations-s This file needs to be sent to link:++https://pagure.io/fedora-web/translations++[translations repository] -If you don't have access to the translations repository push it to fedora-websites and is should be automatically sent to translations repository with 24 hours. +If you don't have access to the translations repository push it to fedora-websites and create a pull request and once approved it should be automatically sent to translations repository with 24 hours. == Weblate process (How strings get translated) @@ -71,12 +67,14 @@ Once edited translations need to be combiled into more efficient format for the [source,bash] ---- -podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/translations-update-local.sh +podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/translations-combile-local.sh ---- +You can now change your browser setting to desired language and see how the translations are working out. +--- -==== Description of translation scripts inside sites/getfedora.org/scripts +=== Description of translation scripts inside sites/getfedora.org/scripts [NOTE] ==== From c92fff4323b6d23a3990525e4ef125fe1449f0a4 Mon Sep 17 00:00:00 2001 From: Jan Kuparinen Date: Jan 15 2021 16:36:27 +0000 Subject: [PATCH 3/4] Changed combiled to compiled --- diff --git a/modules/ROOT/pages/translation-flow.adoc b/modules/ROOT/pages/translation-flow.adoc index d126514..c017809 100644 --- a/modules/ROOT/pages/translation-flow.adoc +++ b/modules/ROOT/pages/translation-flow.adoc @@ -63,11 +63,11 @@ Find the string you want to test, format inside file is: Edit the `msgstr` -Once edited translations need to be combiled into more efficient format for the web server. This is done by running: +Once edited translations need to be compiled into more efficient format for the web server. This is done by running: [source,bash] ---- -podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/translations-combile-local.sh +podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/translations-compile-local.sh ---- You can now change your browser setting to desired language and see how the translations are working out. From fe979ca4fe15032dbef1e39450621b14f276d125 Mon Sep 17 00:00:00 2001 From: Jan Kuparinen Date: Feb 02 2021 19:42:03 +0000 Subject: [PATCH 4/4] Make a new page for using podman --- diff --git a/modules/ROOT/nav.adoc b/modules/ROOT/nav.adoc index 6d0a691..87ee335 100644 --- a/modules/ROOT/nav.adoc +++ b/modules/ROOT/nav.adoc @@ -1,6 +1,9 @@ * xref:setup-docker.adoc[Getting Set Up (Docker)] +* xref:setup-podman.adoc[Getting Set Up (Podman)] +** xref:translation-flow.adoc[Translation flow] * xref:setup.adoc[Getting Set Up (old method)] * xref:fedora-release.adoc[Fedora Beta/GA Release] * xref:newcontent.adoc[Creating New Content] ** xref:newcontent-edition.adoc[New Edition] ** xref:newcontent-site.adoc[New Site] + diff --git a/modules/ROOT/pages/setup-podman.adoc b/modules/ROOT/pages/setup-podman.adoc new file mode 100644 index 0000000..1d703df --- /dev/null +++ b/modules/ROOT/pages/setup-podman.adoc @@ -0,0 +1,98 @@ += Getting Set Up (using Podman) +Rick Elrod; Jan Kuparinen +:page-authors: {author}, {author_2} + +== Preliminary Notes + +It is now easier to get started on developing the Fedora Websites with the use +of Podman. This document describes the newest web development of +link:++https://getfedora.org/++[getfedora.org]. + +We ship a `Dockerfile` which will install dependencies into an image +for you, so all you are left to do is mount the site as a volume, pull +translations, and start the development server. + +[NOTE] +==== +The documentation here refers to `podman`, but you can most likely get it to work with `docker` with little or no modifications. +==== + +== Building the container image + +First clone the repository: + +[source,bash] +---- +git clone https://pagure.io/fedora-web/websites.git +---- + +(You may instead clone your fork of it, or add your fork as a second +remote later on.) + +Go to websites folder: + +[source,bash] +---- +cd websites +---- + +Now ensure you have Podman installed by running: + +[source,bash] +---- +which podman +---- + +Build a container image for you to use by running: + +[source,bash] +---- +podman build -t fedora-websites . +---- + +== Pulling translations + +We have a script for pulling and compiling translations. +Let's call it from within the container: + +[source,bash] +---- +podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites ./scripts/pull-translations.sh +---- + + +Notice here that we are mounting a volume (`-v`) in Docker which +points to our check-out of the repository. We're referring to the +`fedora-websites` image created above, and calling the +`./scripts/pull-translations.sh` script from within it. + +== Adding magazine posts + +Another scripts gets latest posts for the Fedora magazine section. +Run: + +[source,bash] +---- +podman run -it --rm -v "$(pwd):/opt/:z" fedora-websites python ./scripts/pull-magazine.py +---- + + +== Running the development server + +Now we are ready to run the development server: + +[source,bash] +---- +podman run -it --rm -v "$(pwd):/opt/:z" -p 5000:5000 fedora-websites flask run --reload --host 0.0.0.0 +---- + +Note that we need `-p 5000:5000` so that we can access the development +server from our actual host. Also notice that we need to tell Flask to +listen on `0.0.0.0` as by default it listens on `127.0.0.1` which +won't be accessible outside of the container. + +You may now go to `http://localhost:5000/` in your browser of choice. + +Now you are ready to go and any changes you make in the repository +should be reflected immediately upon refreshing the page in your +browser.