fpm
FPM provides a first class support for translations of the documents. A particular package can either be a translation or have translations pointing to other packages. At the build time, we process your translations and generate metadata for each and every page in the corresponding package to ensure you as the project maintainer, have a complete idea about what is going on in your project.
A translation package keeps track of your documents and helps you keep the documents in sync with each other.
A translation is a two way agreement between two packages.
You’ll need to set up two fpm
packages to enable translation across the two of
them.
For this example, we’ll be using foo.com
and bar.com
where bar.com
is the
translation of foo.com
foo.com
= master
bar.com
= translation
Please familiarize yourself with our Translation Philosphy to get acquainted with the terminologies used in the document
master
packagemaster
package needs to specify the language it’s targetting. At the very core, this is the bare minimum setting you’ll require to enable the translations for your master
package-- import: fpm -- fpm.package: foo.com language: English
$/foo.com/> touch example{01..05}.ftd
fpm sync
fpm sync
command allows you to synchronize your changes and create a snapshot of the package at the current timestamp in the .history
folder in the root directory of your package.fpm sync
output$ /foo.com/> fpm sync Repo for foo.com is github, directly syncing with .history. FPM.ftd example01.ftd example02.ftd example03.ftd example04.ftd example05.ftd
translation
packagetranslation
package must specify the translation-of
package. Specifying this marks the current package as the translation-of
of another package.-- import: fpm -- fpm.package: bar.com translation-of: foo.com language: hi
bar.com
package.$/bar.com/> touch example{01..03}.ftd
$/bar.com/> fpm translation-status Never marked: FPM.ftd Never marked: example01.md Never marked: example02.ftd Never marked: example03.ftd Missing: example04.ftd Missing: example05.ftd
fpm translation-status
command will give you a complete overview of the documents in the current package.fpm mark-upto-date
upto date
in the translation tree. Doing so will create a track
of your document at the current timestamp.$/bar.com/> fpm mark-upto-date example01.ftd example01.ftd is now marked upto date \$/bar.com/> fpm mark-upto-date example02.ftd example02.ftd is now marked upto date \$/bar.com/> fpm translation-status Never marked: FPM.ftd Up to date: example01.md Up to date: example02.ftd Never marked: example03.ftd Missing: example04.ftd Missing: example05.ftd
While anyone can start a package as a translation candidate to your master
package,
you get to decide what all packages act as official for your package.
The translation candidate repository(bar.com) can be marked an official
translation of foo.com
by mapping the the same in foo.com/FPM.ftd
file along
with providing the name of the language the current package belongs to.
The translation
-- import: fpm -- fpm.package: foo.com language: English translation: bar.com
official
translations of your package by using the fpm translation-status
command. For a master
package, it returns a global view across all the translationsmaster
fpm translation-status$/foo.com/> fpm translation-status Status for `bar.com` package: Never marked: 2 Missing: 2 Out-dated: 0 Up to date: 2
master
packagetranslation
package getting downgraded to Out-dated
.$/foo.com/> echo "\n-- ftd.text: Hello World" >> example01.ftd \$/foo.com/> fpm sync Repo for foo.com is github, directly syncing with .history. example01.ftd
fpm translation-status
in context of the translation
package(/bar.com/), we should see the Out-dated
document statusbar.com
translation-status$/bar.com/> fpm translation-status Never marked: FPM.ftd Out-dated: example01.md Up to date: example02.ftd Never marked: example03.ftd Missing: example04.ftd Missing: example05.ftd