Could take the PotGenerator class, create an abstract base class / plugin registration system, then allow generating FTL files the same way. Obviously needs larger upstream changes.
While POT uses English messages as translation keys, FTL has separate keys. So unlike POT, you'll want to enter translation keys into your UI, and have those get extracted like key = UNTRANSLATED. Not sure how this works with ETR/ETRN translations though (I don't think FTL supports spaces in translation keys, so those might need to be converted to a "compatible" format)...
Alternative approach would be a custom EditorPlugin that adds some kind of UI. This provides more flexibility:
It could be interesting to allow multiple FTL files split up in some way, e.g. by folder or by file.
Existing files can be merged so that existing changes don't get lost - new keys are appended.
Similar "translation extraction plugin" class that the user can write to decide how certain files should fill a FTL:
Would also support extracting attributes and terms.
Could let the user choose whether they want the messages themselves to be translation keys (with some "convert illegal characters to underscores/dashes" logic), or define custom translation keys.
Could generate boilerplate for plural selectors?
First draft for how to configure this (no UI, just plaintext multiline):
Could take the PotGenerator class, create an abstract base class / plugin registration system, then allow generating FTL files the same way. Obviously needs larger upstream changes.
While POT uses English messages as translation keys, FTL has separate keys. So unlike POT, you'll want to enter translation keys into your UI, and have those get extracted like
key = UNTRANSLATED
. Not sure how this works withETR
/ETRN
translations though (I don't think FTL supports spaces in translation keys, so those might need to be converted to a "compatible" format)...Alternative approach would be a custom EditorPlugin that adds some kind of UI. This provides more flexibility:
First draft for how to configure this (no UI, just plaintext multiline):
{$locale}
is replaced with the current locale{$n}
is replaced with the n-th matched capture groupsource > ftl
lines.Example syntax: