Add POT export and PO import.
AbandonedPublic

Authored by woltherav on Sep 22 2018, 4:16 PM.

Details

Reviewers
leinir
Summary

first part of T9713

The logic behind this one is to give a really quick way of adding or removing translations, by using the gettext POT workflow, so translators can use POEdit or Lokalize to do translations.

This is also because a dedicated translation gui might take a while to design :)

Test Plan

Tested with PO edit.

Diff Detail

Repository
R157 Peruse
Lint
Lint Skipped
Unit
Unit Tests Skipped
woltherav requested review of this revision.Sep 22 2018, 4:16 PM
woltherav created this revision.
woltherav updated this revision to Diff 42147.Sep 22 2018, 6:37 PM

Updating with...

  • Dialog giving a summary of the po file to import and asking whether to include the author's email.
  • Copy to default layer. This is useful when there's no default layer and we just select one.
  • Coverimage is included now.
  • Add a language layer show toggle.
pino added a subscriber: pino.Sep 22 2018, 7:46 PM

Not sure I understand, what is the exact workflow that involves writing a .pot file, and reading .po files? Is it because peruse so far is not translatable?
If so, then it'd be much better to extract the messages, and make sure to use ki18n to translate the strings at runtime, just like all the other applications.

In D15692#330282, @pino wrote:

Not sure I understand, what is the exact workflow that involves writing a .pot file, and reading .po files? Is it because peruse so far is not translatable?
If so, then it'd be much better to extract the messages, and make sure to use ki18n to translate the strings at runtime, just like all the other applications.

Ah, no, what this is for is something else. You see, Peruse Creator makes cbz(comic book) files, and also generates metadata files for cbz, this is done in the ACBF format. The ACBF format supports metadata for text within the comic and holding translations for said text. I figured that it'd be helpful to be able to take these translatable entries, and generate POT files for them (as well as import of translation po files). That way people who'd want to translate a comic can use their favourite pot/po compatible translation tools.

Peruse itself is translatable, it uses i18n and i18nc tags. I'm sorry if this scared you :p

pino added a comment.Sep 22 2018, 8:02 PM
In D15692#330282, @pino wrote:

Not sure I understand, what is the exact workflow that involves writing a .pot file, and reading .po files? Is it because peruse so far is not translatable?
If so, then it'd be much better to extract the messages, and make sure to use ki18n to translate the strings at runtime, just like all the other applications.

Ah, no, what this is for is something else. You see, Peruse Creator makes cbz(comic book) files, and also generates metadata files for cbz, this is done in the ACBF format. The ACBF format supports metadata for text within the comic and holding translations for said text. I figured that it'd be helpful to be able to take these translatable entries, and generate POT files for them (as well as import of translation po files). That way people who'd want to translate a comic can use their favourite pot/po compatible translation tools.

OK. If so, then please use the gettext-po C library (part of gettext) to read and write po files, instead of home-brew code that can easily break.
See poxml for examples of reading, and writing.

Peruse itself is translatable, it uses i18n and i18nc tags. I'm sorry if this scared you :p

I checked after I saw this review, and sadly the is no message extraction... i18n*() seems used mostly, but there are no translations loaded. That is a separate issue though, I can take a look at it.

woltherav abandoned this revision.Sep 22 2018, 10:01 PM