summaryrefslogtreecommitdiff
path: root/make/po4a.mk
blob: 508935c29d6988d0359360fb50644521d6742fc7 (plain)
  1. package PACKAGE
  2. module MODULE
  3. version VERSION
  4. locale LOCALE
  5. # override with e.g. htmltemplate when handling non-Markdown files
  6. fileformat text
  7. # Percentage of l10n completed to be acceptable
  8. threshold 100
  9. # l10nfiles: relative paths to localizable files
  10. # Invoke from inside basedir of master files
  11. # potfile: path to POT file
  12. mkpot:
  13.     po4a-gettextize -M UTF-8 -L UTF-8 -"$(fileformat)" -o markdown $(patsubst %,-%,$(l10nfiles)) -"$(potfile)"
  14.     sed -i \
  15.       -'s/^# SOME DESCRIPTIVE TITLE/# $(locale) translation of $(module) pages for $(package)./' \
  16.       -'/^# This file/ s/PACKAGE/$(package)/' \
  17.       -'/^"Project-Id-Version:/ s/PACKAGE/$(package) $(module)/' \
  18.       -'/^"Project-Id-Version:/ s/VERSION/$(version)/' \
  19.       -'/^"Content-Type:/ s/CHARSET/UTF-8/' \
  20.       -'/^"Content-Transfer-Encoding:/ s/ENCODING/8bit/' \
  21.       "$(potfile)"
  22. # Invoke from root dir of translated files
  23. # masterdir: path to dir containing untranslated files
  24. # pofile: path to PO file
  25. mkpo:
  26.     po4a-gettextize -M UTF-8 -L UTF-8 -"$(fileformat)" -o markdown $(patsubst %,-%,$(l10nfiles)) $(patsubst %,-$(masterdir)/%,$(l10nfiles)) -"$(pofile)"
  27. # Invoke from inside basedir of master files
  28. # pofile: path to PO file
  29. updatepo:
  30.     po4a-updatepo -M UTF-8 -"$(fileformat)" -o markdown $(patsubst %,-%,$(l10nfiles)) -"$(pofile)"
  31. # Invoke from root dir of translated files
  32. # masterdir: path to dir containing untranslated files
  33. # pofile: path to PO file
  34. $(l10nfiles): % : $(masterdir)/%
  35.     po4a-translate -M UTF-8 -L UTF-8 -"$(threshold)" -"$(fileformat)" -o markdown $(patsubst %,-$(masterdir)/%,$@) -"$(pofile)" -"$@"
  36. .PHONYmkpot mkpo $(l10nfiles)