Commit 5f39a626 authored by Yann Leboulanger's avatar Yann Leboulanger

improve translation generation

parent 9d80ef00
Pipeline #4197 passed with stages
in 4 seconds
---
title: Gajim
subtitle: Gajim, ein vollwertiger XMPP Client
comments: false
---
<table class="startpage-download">
<tr>
<td>
<img src="/img/gajim-logo.png"/>
</td>
<td>
<div class="dropdown show">
<a class="btn btn-success dropdown-toggle" href="#" role="button" id="downloadDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Herunterladen</a>
<div class="dropdown-menu" aria-labelledby="downloadDropdown">
<a class="dropdown-item" href="download#windows">Windows</a>
<a class="dropdown-item" href="download#macos">MacOS</a>
<a class="dropdown-item" href="download#linux">Linux</a>
</div>
</div>
</td>
</tr>
</table>
### Features
* Verpasse keine Nachrichten, halte alle deine Chat-Clients synchron
* Lade Freunde zum Gruppenchat ein oder tritt selbst einem bei
* Teile Fotos, Videos und andere Dateien mit Freunden und Gruppen
* Chatte sicher und verschlüsselt durch Ende-zu-Ende-Verschlüsselung per [OMEMO](https://dev.gajim.org/gajim/gajim-plugins/wikis/OmemoGajimPlugin) bzw. [PGP](https://dev.gajim.org/gajim/gajim-plugins/wikis/pgpplugin).
* Benutze deine liebsten Emojis, lade deinen eigenen Avatar hoch
* Behalte und verwalte alle deine Unterhaltungsverläufe
* Ordne deine Chats mit Tabs
* Automatische Rechtschreibprüfung für deine Nachrichten
* Verbinde dich mit anderen Messengern durch Transports (Facebook, IRC, ...)
* Schaue Dinge bei Wikipedia, in Wörterbüchern oder anderen Suchmaschinen nach - direkt aus dem Chat-Fenster
* Was tust du gerade? Welche Musik hörst du im Moment? Wie fühlst du dich? Wenn du magst, teile es mit deinen Freunden durch Aktivitäten, Musik und Stimmung
* Erweiterbarer Funktionsumfang durch [Plugins](https://dev.gajim.org/gajim/gajim-plugins/wikis/home), zum Beispiel: Bildvorschau, Standortvorschau, Anti Spam, ...
* Gajim ist in [29 Sprachen](https://dev.gajim.org/gajim/gajim/wikis/development/TranslationsList) verfügbar
### Spezielle Features
* Unterstützung für mehrere Konten
* Einer deiner Freunde hat überall Konten, aber du willst nur einen einzelnen Kontakt, dem du schreiben kannst? Gruppiere mehrere Kontakte zu einem Meta-Kontakt
* XML-Konsole, um zu sehen, was auf Protokollebene passiert
* Serverlose Chats im lokalen Netzwerk (Bonjour/Zeroconf), BOSH
* Unterstützung für Service discovery inkl. Nodes, Benutzer-Suche
* DBus-Unterstützung
---
title: Entwicklung
subtitle: Gajim-Entwicklung
comments: false
---
## How to reach us
Come join us at [gajim@conference.gajim.org](xmpp:gajim@conference.gajim.org?join) with an XMPP client of your choice. Discuss new features, report bugs, or just have a chat.
You may also want to [subscribe to our mailing list](gajim-devel-subscribe@gajim.org) (low-traffic), or just [browse the archives](https://lists.gajim.org).
## How you can help
Development happens on [our Gitlab](http://dev.gajim.org/gajim/gajim). Contributions are welcome!
You can help us make Gajim better by:
* Coding: contact us on our mailing list or in our join our group chat [gajim@conference.gajim.org](xmpp:gajim@conference.gajim.org?join)
* Translating: [How to translate](https://dev.gajim.org/gajim/gajim/wikis/development/DevTranslate), get involved and [start translating Gajim](https://translate.gajim.org/projects)
* Bug reporting: in case you find a bug, do not hesitate to [report it](https://dev.gajim.org/gajim/gajim/issues/new)
* Donating:
* [PayPal](https://www.paypal.com/donate/?token=eFHDaiuQ45i6ZiDz9CCv39HkBCdK3PBkDPHjk2zImuiL_OpRe2sHi1MNM80NzvEKqfLPmG&country.x=US&locale.x=US)
* [Flattr](https://flattr.com/@Asterix)
## Development
### Code repository
We use git and gitlab to manage the development. [Gajim](https://dev.gajim.org/gajim/gajim), [Plugins](https://dev.gajim.org/gajim/gajim-plugins), [python-nbxmpp](https://dev.gajim.org/gajim/python-nbxmpp), and this [website](https://dev.gajim.org/gajim/website-dev) you are viewing right now each have their own project.
### Install instructions for development
For Windows, follow [this guide](https://dev.gajim.org/gajim/gajim/blob/master/win/README.md) to set up a development environment for Gajim.
On Linux, you can follow [this guide](https://dev.gajim.org/gajim/gajim/blob/master/README.md).
### Authors
The project is lead by:
* Philipp Hörist (lovetox)
* Yann Leboulanger (Asterix)
---
title: Herunterladen
subtitle: Gajim ist verfügbar für Windows, MacOS und Linux
comments: false
---
**Aktuelle stabile Version: 1.1.3**
## Windows
<div class="dropdown show">
<a class="btn btn-success dropdown-toggle" href="#" role="button" id="win_download" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Herunterladen</a>
<div class="dropdown-menu" aria-labelledby="win_download">
<a class="dropdown-item" href="https://gajim.org/downloads/1.1/gajim-1.1.3-64bits-1.exe">Gajim (64 Bit)</a>
<a class="dropdown-item" href="https://gajim.org/downloads/1.1/gajim-1.1.3-32bits-1.exe">Gajim (32 Bit)</a>
<a class="dropdown-item" href="https://gajim.org/downloads/1.1/gajim-portable-1.1.3-64bits-1.exe">Gajim Portable (64 Bit)</a>
<a class="dropdown-item" href="https://gajim.org/downloads/1.1/gajim-portable-1.1.3-32bits-1.exe">Gajim Portable (32 Bit)</a>
</div>
</div>
You can either install Gajim on your system or use the portable version. Gajim Portable allows you to take everything with you in just a single folder.
If you are curious, you can also try the [latest nightly](https://gajim.org/downloads/snap/win/) of Gajim. But be advised, nightlies can be unstable. Make sure to have a backup of your profile folder. Migrating back is not possible without complications.
## MacOS
Installationsanweisungen für MacOS folgen.
## Linux
Gajim is available on many distributions. Have a look at the [install instructions](#Installation-instructions). Gajim is also available on [flathub.org](https://flathub.org/apps/details/org.gajim.Gajim) and ready for [manual flatpak install](https://dev.gajim.org/gajim/gajim/tree/master/flatpak) as well.
If there is no package for your distribution, you should be able to install Gajim using the [source packages (.tar.bz2)](https://gajim.org/downloads/1.1/gajim-1.1.3.tar.bz2). There is also a [nightly package](https://gajim.org/downloads/snap/?M=D) available.
## Installationsanweisungen (Linux)
### Debian und Ubuntu
Verfügbar in den [Debian Paketen](https://packages.debian.org/de/buster/gajim).
{{< highlight shell >}}
sudo apt-get install gajim
{{</ highlight >}}
### Fedora
Verfügbar in den [Fedora Paketen](https://apps.fedoraproject.org/packages/gajim).
{{< highlight shell >}}
dnf install gajim
{{</ highlight >}}
### OpenSUSE
Verfügbar in den [openSUSE Paketen](https://software.opensuse.org/package/gajim).
{{< highlight shell >}}
sudo zypper install gajim
{{</ highlight >}}
### Archlinux
Verfügbar in den [Arch Linux Paketen](https://www.archlinux.org/packages/?name=gajim).
{{< highlight shell >}}
pacman -S gajim
{{</ highlight >}}
### FreeBSD
Verfügbar in FreeBSD via [FreeBSD ports](https://www.freebsd.org/cgi/ports.cgi?query=gajim).
{{< highlight shell >}}
cd /usr/ports/net/gajim/ && make install clean
{{</ highlight >}}
### Gentoo
Verfügbar in den [Gentoo Paketen](https://packages.gentoo.org/packages/net-im/gajim).
{{< highlight shell >}}
emerge gajim
{{</ highlight >}}
### Nightly-Pakete aus git (Debian, Ubuntu)
In order to install the nightly package from git, you need to use the unstable repository (or at least [backports](https://backports.debian.org/Instructions/)).
1. Remove Gajim:
{{< highlight shell >}}
sudo apt-get remove gajim
{{</ highlight >}}
2. Add the GPG key:
{{< highlight shell >}}
wget -q https://gajim.org/gajim.key -O - | sudo apt-key add -
{{</ highlight >}}
3. Add the repository:
{{< highlight shell >}}
sudo sh -c "echo deb https://ftp.gajim.org/debian unstable main > /etc/apt/sources.list.d/gajim.list"
{{</ highlight >}}
4. Update the repository:
{{< highlight shell >}}
sudo apt-get update
{{</ highlight >}}
5. Install Gajim (stable branch nightly):
{{< highlight shell >}}
sudo apt-get install gajim-nightly
{{</ highlight >}}
6. Or install Gajim (current development nightly):
{{< highlight shell >}}
sudo apt-get install gajim-default-nightly
{{</ highlight >}}
## Alte Releases
If you want to dig through Gajim's history or you just liked the older version better, have a look at the [old releases](https://gajim.org/downloads/).
---
title: Neue Website
subtitle: gajim.org hat ein Update bekommen
date: 2019-08-24
---
Es war an der Zeit, gajim.org ein neues Aussehen zu verpassen. Die neue Website läuft auf [Hugo](https://gohugo.io/), was einige Verbesserungen mit sich bringt:
* Schnelles Bearbeiten der Seiten mit Markdown
* Gute Integration und einfache Bereitstellung durch Gitlab
* Native Code-Hervorhebung
---
title: Neuigkeiten
---
---
title: Bildschirmfotos
subtitle: Bildschirmfotos von Gajim
comments: false
---
{{< gallery hover-effect="none" caption-effect="none" >}}
{{< figure link="/img/screenshots/single-window-mode.png" caption="Single window mode">}}
{{< figure link="/img/screenshots/groupchat-window.png" caption="Group chats" >}}
{{< figure link="/img/screenshots/history-window.png" caption="Chat history window" >}}
{{< /gallery >}}
{{< load-photoswipe >}}
......@@ -2,7 +2,7 @@
title: Development
subtitle: Gajim development
comments: false
---
---
## How to reach us
......
......@@ -2,7 +2,7 @@
title: Screenshots
subtitle: Screenshots of Gajim
comments: false
---
---
{{< gallery hover-effect="none" caption-effect="none" >}}
{{< figure link="/img/screenshots/single-window-mode.png" caption="Single window mode">}}
......
---
title: Development
subtitle: Gajim development
comments: false
---
## How to reach us
Come join us at [gajim@conference.gajim.org](xmpp:gajim@conference.gajim.org?join) with an XMPP client of your choice. Discuss new features, report bugs, or just have a chat.
You may also want to [subscribe to our mailing list](gajim-devel-subscribe@gajim.org) (low-traffic), or just [browse the archives](https://lists.gajim.org).
## How you can help
Development happens on [our Gitlab](http://dev.gajim.org/gajim/gajim). Contributions are welcome!
You can help us make Gajim better by:
* Coding: contact us on our mailing list or in our join our group chat [gajim@conference.gajim.org](xmpp:gajim@conference.gajim.org?join)
* Translating: [How to translate](https://dev.gajim.org/gajim/gajim/wikis/development/DevTranslate), get involved and [start translating Gajim](https://translate.gajim.org/projects)
* Bug reporting: in case you find a bug, do not hesitate to [report it](https://dev.gajim.org/gajim/gajim/issues/new)
* Donating:
* [PayPal](https://www.paypal.com/donate/?token=eFHDaiuQ45i6ZiDz9CCv39HkBCdK3PBkDPHjk2zImuiL_OpRe2sHi1MNM80NzvEKqfLPmG&country.x=US&locale.x=US)
* [Flattr](https://flattr.com/@Asterix)
## Development
### Code repository
We use git and gitlab to manage the development. [Gajim](https://dev.gajim.org/gajim/gajim), [Plugins](https://dev.gajim.org/gajim/gajim-plugins), [python-nbxmpp](https://dev.gajim.org/gajim/python-nbxmpp), and this [website](https://dev.gajim.org/gajim/website-dev) you are viewing right now each have their own project.
### Install instructions for development
For Windows, follow [this guide](https://dev.gajim.org/gajim/gajim/blob/master/win/README.md) to set up a development environment for Gajim.
On Linux, you can follow [this guide](https://dev.gajim.org/gajim/gajim/blob/master/README.md).
### Authors
The project is lead by:
* Philipp Hörist (lovetox)
* Yann Leboulanger (Asterix)
---
title: Download
subtitle: Gajim is available for Windows, MacOS, and Linux
comments: false
---
**Current stable version: 1.1.3**
## Windows
<div class="dropdown show">
<a class="btn btn-success dropdown-toggle" href="#" role="button" id="win_download" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Download</a>
<div class="dropdown-menu" aria-labelledby="win_download">
<a class="dropdown-item" href="https://gajim.org/downloads/1.1/gajim-1.1.3-64bits-1.exe">Gajim (64 Bit)</a>
<a class="dropdown-item" href="https://gajim.org/downloads/1.1/gajim-1.1.3-32bits-1.exe">Gajim (32 Bit)</a>
<a class="dropdown-item" href="https://gajim.org/downloads/1.1/gajim-portable-1.1.3-64bits-1.exe">Gajim Portable (64 Bit)</a>
<a class="dropdown-item" href="https://gajim.org/downloads/1.1/gajim-portable-1.1.3-32bits-1.exe">Gajim Portable (32 Bit)</a>
</div>
</div>
You can either install Gajim on your system or use the portable version. Gajim Portable allows you to take everything with you in just a single folder.
If you are curious, you can also try the [latest nightly](https://gajim.org/downloads/snap/win/) of Gajim. But be advised, nightlies can be unstable. Make sure to have a backup of your profile folder. Migrating back is not possible without complications.
## MacOS
MacOS instructions to follow.
## Linux
Gajim is available on many distributions. Have a look at the [install instructions](#Installation-instructions). Gajim is also available on [flathub.org](https://flathub.org/apps/details/org.gajim.Gajim) and ready for [manual flatpak install](https://dev.gajim.org/gajim/gajim/tree/master/flatpak) as well.
If there is no package for your distribution, you should be able to install Gajim using the [source packages (.tar.bz2)](https://gajim.org/downloads/1.1/gajim-1.1.3.tar.bz2). There is also a [nightly package](https://gajim.org/downloads/snap/?M=D) available.
## Install instructions (Linux)
### Debian and Ubuntu
Available in [Debian packages](https://packages.debian.org/de/buster/gajim).
{{< highlight shell >}}
sudo apt-get install gajim
{{</ highlight >}}
### Fedora
Available in [Fedora packages](https://apps.fedoraproject.org/packages/gajim).
{{< highlight shell >}}
dnf install gajim
{{</ highlight >}}
### openSUSE
Available in [openSUSE packages](https://software.opensuse.org/package/gajim).
{{< highlight shell >}}
sudo zypper install gajim
{{</ highlight >}}
### Arch Linux
Available in [Arch Linux packages](https://www.archlinux.org/packages/?name=gajim).
{{< highlight shell >}}
pacman -S gajim
{{</ highlight >}}
### FreeBSD
Available in FreeBSD via [FreeBSD ports](https://www.freebsd.org/cgi/ports.cgi?query=gajim).
{{< highlight shell >}}
cd /usr/ports/net/gajim/ && make install clean
{{</ highlight >}}
### Gentoo
Available in [Gentoo packages](https://packages.gentoo.org/packages/net-im/gajim).
{{< highlight shell >}}
emerge gajim
{{</ highlight >}}
### Nightly package from git (Debian, Ubuntu)
In order to install the nightly package from git, you need to use the unstable repository (or at least [backports](https://backports.debian.org/Instructions/)).
1. Remove Gajim:
{{< highlight shell >}}
sudo apt-get remove gajim
{{</ highlight >}}
2. Add the GPG key:
{{< highlight shell >}}
wget -q https://gajim.org/gajim.key -O - | sudo apt-key add -
{{</ highlight >}}
3. Add the repository:
{{< highlight shell >}}
sudo sh -c "echo deb https://ftp.gajim.org/debian unstable main > /etc/apt/sources.list.d/gajim.list"
{{</ highlight >}}
4. Update the repository:
{{< highlight shell >}}
sudo apt-get update
{{</ highlight >}}
5. Install Gajim (stable branch nightly):
{{< highlight shell >}}
sudo apt-get install gajim-nightly
{{</ highlight >}}
6. Or install Gajim (current development nightly):
{{< highlight shell >}}
sudo apt-get install gajim-default-nightly
{{</ highlight >}}
## Old releases
If you want to dig through Gajim's history or you just liked the older version better, have a look at the [old releases](https://gajim.org/downloads/).
---
title: Gajim
subtitle: Gajim, a fully-featured XMPP client
comments: false
---
<table class="startpage-download">
<tr>
<td>
<img src="/img/gajim-logo.png"/>
</td>
<td>
<div class="dropdown show">
<a class="btn btn-success dropdown-toggle" href="#" role="button" id="downloadDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Download</a>
<div class="dropdown-menu" aria-labelledby="downloadDropdown">
<a class="dropdown-item" href="download#windows">Windows</a>
<a class="dropdown-item" href="download#macos">MacOS</a>
<a class="dropdown-item" href="download#linux">Linux</a>
</div>
</div>
</td>
</tr>
</table>
### Features
* Never miss a message, keep all your chat clients synchronized
* Invite friends to group chats or join one
* Simply send pictures, videos or other files to friends and groups
* Chat securely with End-to-End encryption via [OMEMO](https://dev.gajim.org/gajim/gajim-plugins/wikis/OmemoGajimPlugin) or [PGP](https://dev.gajim.org/gajim/gajim-plugins/wikis/pgpplugin).
* Use your favorite emoticons, set your own profile picture
* Keep and manage all your chat history
* Organize your chats with tabs
* Automatic spell-checking for your messages
* Connect to other Messengers via Transports (Facebook, IRC, ...)
* Lookup things on Wikipedia, dictionaries or other search engines directly from the chat window
* Share what are up to, which music are you listing to, or how you are feeling lately by setting your activity, tune, and mood
* Even more features via plugins, for example: Image Previews, Location Previews, Anti Spam, ...
* Gajim is available in [29 languages](https://dev.gajim.org/gajim/gajim/wikis/development/TranslationsList)
### Advanced Features
* Support for multiple accounts
* One of your friends has accounts everywhere but you just want one contact you can easily write to? Group multiple contacts to a single Meta-Contact
* XML console to see what's happening on the protocol layer
* Serverless messaging (Bonjour/Zeroconf), BOSH
* Support for service discovery including nodes and search for users
* DBus capabilities
---
title: Gajim 1.1.0
subtitle: Version 1.1.0 of Gajim has been released
date: 2018-11-06
---
What's new since 1.0.3:
* Emoji updates
* Design updates for many dialogs and windows
* Support for PKIX over secure HTTP (POSH)
* Improvements with MAM for MUC (group chat history)
* Have a look at the [full changelog](https://dev.gajim.org/gajim/gajim/blob/gajim-1.1.0/ChangeLog)
---
title: Gajim 1.1.1
subtitle: Version 1.1.1 of Gajim has been released
date: 2018-12-24
---
What's new since 1.1.0:
* This is a bugfix release, several minor bugs were fixed
* Have a look at the [full changelog](https://dev.gajim.org/gajim/gajim/blob/gajim-1.1.1/ChangeLog)
---
title: Gajim 1.1.2
subtitle: Version 1.1.2 of Gajim has been released
date: 2019-01-15
---
What's new since 1.1.1:
* This is a bugfix release, several minor bugs were fixed
* Have a look at the [full changelog](https://dev.gajim.org/gajim/gajim/blob/gajim-1.1.2/ChangeLog)
---
title: Gajim 1.1.3
subtitle: Version 1.1.3 of Gajim has been released
date: 2019-04-23
---
What's new since 1.1.2:
* This is a bugfix release, several minor bugs were fixed
* Have a look at the [full changelog](https://dev.gajim.org/gajim/gajim/blob/gajim-1.1.3/ChangeLog)
---
title: New website
subtitle: gajim.org got an update
date: 2019-08-24
---
It was about time to give gajim.org a new look. The new website is powered by [Hugo](https://gohugo.io/), which brings many improvements:
* Simple page editing via markdown
* Easy integration and deployment with Gitlab
* Native syntax highlighting
---
title: Screenshots
subtitle: Screenshots of Gajim
comments: false
---
{{< gallery hover-effect="none" caption-effect="none" >}}
{{< figure link="/img/screenshots/single-window-mode.png" caption="Single window mode">}}
{{< figure link="/img/screenshots/groupchat-window.png" caption="Group chats" >}}
{{< figure link="/img/screenshots/history-window.png" caption="Chat history window" >}}
{{< /gallery >}}
{{< load-photoswipe >}}
......@@ -24,13 +24,20 @@ DIR_CONTENT=${DIR_SRC}/content
function md2po {
echo "Converting .md source into .pot files"
rm -rf ${DIR_CONTENT}
mkdir ${DIR_CONTENT}
mkdir ${DIR_CONTENT}/index
cp -r ${DIR_SRC}/../../content/en/* ${DIR_CONTENT}/
mv ${DIR_CONTENT}/_index.md ${DIR_CONTENT}/index/
if [ -d ${DIR_BUILD} ]; then rm -r ${DIR_BUILD}; fi
generate_pot_file index
generate_pot_file development
generate_pot_file download
generate_pot_file post
generate_pot_file screenshots
rm -r ${DIR_BUILD}
msgcat --no-wrap --lang=en_US --add-location=file -o ${DIR_PO}/website.pot ${DIR_BUILD}/*.pot
rm -rf ${DIR_BUILD}
}
#
......@@ -51,7 +58,7 @@ function generate_pot_file {
SRC_SUBDIR=${DIR_CONTENT}/${SECTION}
BUILD_SUBDIR=${DIR_BUILD}/${SECTION}/md
DIR_BUILD_PO=${DIR_BUILD}/${SECTION}/po
OUT_POT_FILE=${DIR_PO}/${SECTION}.pot
OUT_POT_FILE=${DIR_BUILD}/${SECTION}.pot
echo "Generating .pot files for $SECTION:"
cp_md_strip_frontmatter_dir ${SRC_SUBDIR} ${BUILD_SUBDIR}
......@@ -83,6 +90,12 @@ function po2md {
if [ -d ${DIR_BUILD} ]; then rm -r ${DIR_BUILD}; fi
generate_md_files index
for PO in ${DIR_PO}/*.po; do
PO_FILE=`basename ${PO}`
LOCALE=`echo ${PO_FILE} | sed -e "s/\(.*\)\.po/\1/"`
mv ${DIR_CONTENT}/${LOCALE}/index/_index.md ${DIR_CONTENT}/${LOCALE}/_index.md
rm -r ${DIR_CONTENT}/${LOCALE}/index
done
generate_md_files development
generate_md_files download
generate_md_files post
......@@ -114,87 +127,62 @@ function generate_md_files {
cp_md_strip_frontmatter_dir ${SRC_SUBDIR} ${BUILD_SUBDIR}/md
#languages=`sed -nE 's,^languages:(.*)\] *, \1 ,p' _config.yml | sed 's/[^a-zA-Z_ ]/ /g'`
# Languages have to be specified manually. Put language codes in ''
languages="'en' 'de' 'fr'"
if [ `check_for_po ${SECTION}` = true ]; then
for PO in ${DIR_PO}/${SECTION}.*.po; do
PO_FILE=`basename ${PO}`
LOCALE=`echo ${PO_FILE} | sed -e "s/${SECTION}\.\(.*\)\.po/\1/"`
(echo $languages | grep --fixed-strings "'$LOCALE'") || continue
OUT_DIR_I18N_MD=${DIR_CONTENT}/${SECTION}/${LOCALE}
BUILD_DIR_I18N_MD=${BUILD_SUBDIR}/${LOCALE}
echo "Generating $LOCALE translations from $PO_FILE..."
rm -rf ${OUT_DIR_I18N_MD}
mkdir -p ${OUT_DIR_I18N_MD} ${BUILD_DIR_I18N_MD}
for MD in ${BUILD_SUBDIR}/md/*.md; do
MD_FILE=`basename ${MD}`
OUT_TMP_MD_FILE=${BUILD_DIR_I18N_MD}/${MD_FILE}
OUT_MD_FILE=${OUT_DIR_I18N_MD}/${MD_FILE}
# Extract a the .po file for the translated markdown
# file. Count up how many translated strings there are
# for this file. If none, then don't bother converting
# (it will just take up space in our repo and make it
# harder to see what is actually translated). Need to
# take the `realpath`, becuase msggrep will fail with
# "./build/..." but succeed with "build/..."
SRC_MD_FILE=`realpath --relative-to . ${BUILD_SUBDIR}`/md/${MD_FILE}
TRANSLATED=`msggrep --location=${SRC_MD_FILE} ${DIR_PO}/${PO_FILE} | msgattrib --translated | wc -l`
if [ ${TRANSLATED} == "0" ]; then
echo "Ignoring untranslated $OUT_MD_FILE"
continue;
fi
echo "Translating $OUT_MD_FILE"
po4a-translate -f text -o markdown -L utf-8 -M utf-8 -m ${MD} -p ${PO} -l ${OUT_TMP_MD_FILE} -k 0
# Extract the front matter from the source and add it
# to the top of the final i18n .md file (after
# stripping the "# [TITLE]" line we added
# earlier). This is used to replace the "title:" from
# the translated .md file and replace it with the i18n
# "title:". In the process we ensure that the
# frontmatter contains the correct `lang:` attribute.
TITLE=`sed -n '1 p' ${OUT_TMP_MD_FILE} | sed 's/^# //'`
SUBTITLE=`sed -n '2 p' ${OUT_TMP_MD_FILE} | sed 's/^## //'`
extract_frontmatter ${SRC_SUBDIR}/${MD_FILE} | sed "s/^title:.*/title: $TITLE/;s/^subtitle:.*/subtitle: $SUBTITLE/" >> ${OUT_MD_FILE}
# Finally, copy the translated .md file with no
# frontmatter, and without the "# Title" we previously
# injected into there either, into the final .md file.
tail -n +3 ${OUT_TMP_MD_FILE} >> ${OUT_MD_FILE}
done
for PO in ${DIR_PO}/*.po; do
PO_FILE=`basename ${PO}`
LOCALE=`echo ${PO_FILE} | sed -e "s/\(.*\)\.po/\1/"`
OUT_DIR_I18N_MD=${DIR_CONTENT}/${LOCALE}/${SECTION}
BUILD_DIR_I18N_MD=${BUILD_SUBDIR}/${LOCALE}
echo "Generating $LOCALE translations from $PO_FILE..."
rm -rf ${OUT_DIR_I18N_MD}
mkdir -p ${OUT_DIR_I18N_MD} ${BUILD_DIR_I18N_MD}
for MD in ${BUILD_SUBDIR}/md/*.md; do
MD_FILE=`basename ${MD}`
OUT_TMP_MD_FILE=${BUILD_DIR_I18N_MD}/${MD_FILE}
OUT_MD_FILE=${OUT_DIR_I18N_MD}/${MD_FILE}
# Extract a the .po file for the translated markdown
# file. Count up how many translated strings there are
# for this file. If none, then don't bother converting
# (it will just take up space in our repo and make it
# harder to see what is actually translated). Need to
# take the `realpath`, becuase msggrep will fail with
# "./build/..." but succeed with "build/..."
SRC_MD_FILE=`realpath --relative-to . ${BUILD_SUBDIR}`/md/${MD_FILE}
TRANSLATED=`msggrep --location=${SRC_MD_FILE} ${DIR_PO}/${PO_FILE} | msgattrib --translated | wc -l`
if [ ${TRANSLATED} == "0" ]; then
echo "Ignoring untranslated $OUT_MD_FILE"
continue;
fi
echo "Translating $OUT_MD_FILE"
po4a-translate -f text -o markdown -L utf-8 -M utf-8 -m ${MD} -p ${PO} -l ${OUT_TMP_MD_FILE} -k 0
# Extract the front matter from the source and add it
# to the top of the final i18n .md file (after
# stripping the "# [TITLE]" line we added
# earlier). This is used to replace the "title:" from
# the translated .md file and replace it with the i18n
# "title:". In the process we ensure that the
# frontmatter contains the correct `lang:` attribute.
TITLE=`sed -n '1 p' ${OUT_TMP_MD_FILE} | sed 's/^# //'`
SUBTITLE=`sed -n '2 p' ${OUT_TMP_MD_FILE} | sed 's/^## //'`
extract_frontmatter ${SRC_SUBDIR}/${MD_FILE} | sed "s/^title:.*/title: $TITLE/;s/^subtitle:.*/subtitle: $SUBTITLE/" >> ${OUT_MD_FILE}
# Finally, copy the translated .md file with no
# frontmatter, and without the "# Title" we previously
# injected into there either, into the final .md file.
tail -n +3 ${OUT_TMP_MD_FILE} >> ${OUT_MD_FILE}
done
fi
done
}