I'll share my experiments with you.
dtd2po.php
Takes en-US .dtd and old localized .dtd and creates .po from them.
po2dtd.php
Takes translated .po, combines it with template based on original en-US .dtd and creates updated localized .dtd.
updater.php
Personally I have no problem working with .dtd files directly. But what I miss, is a simple way to find out what was changed in original en-US .dtd. This script attempts to solve that. It takes original (previous version) en-US .dtd and compares it with updated (current version) en-US .dtd. Then it takes old localized .dtd and updates it to reflect changes in en-US .dtd.
For example, for old en-US .dtd:
Code: Select all
<!-- Tab context menu -->
<!ENTITY reloadTab.label "Reload Tab">
<!ENTITY reloadTab.accesskey "R">
<!ENTITY reloadAllTabs.label "Reload All Tabs">
<!ENTITY reloadAllTabs.accesskey "A">
And updated en-US .dtd (added, deleted and changed stuff):
Code: Select all
<!-- Tab context menu -->
<!ENTITY reloadTab.label "Updated Reload Tab">
<!ENTITY reloadAllTabs.label "Reload All Tabs">
<!ENTITY reloadAllTabs.accesskey "A">
<!-- Some new comment -->
<!ENTITY reloadAllTabs.newstring "Added string">
From old localized .dtd:
Code: Select all
<!-- Tab context menu -->
<!ENTITY reloadTab.label "Obnovit panel">
<!ENTITY reloadTab.accesskey "O">
<!ENTITY reloadAllTabs.label "Obnovit všechny panely">
<!ENTITY reloadAllTabs.accesskey "b">
Creates updated localized .dtd:
Code: Select all
<!-- Tab context menu -->
<!-- PMTRANSLATE: changed: Reload Tab / Obnovit panel => Updated Reload Tab / ??? -->
<!ENTITY reloadTab.label "Updated Reload Tab">
<!ENTITY reloadAllTabs.label "Obnovit všechny panely">
<!ENTITY reloadAllTabs.accesskey "b">
<!-- Some new comment -->
<!-- PMTRANSLATE: added -->
<!ENTITY reloadAllTabs.newstring "Added string">
It uses the exact structure of updated en-US .dtd (order of lines, comments) and clearly marks what needs to be translated. Currently it does not work incrementally, i.e. the previously existing PMTRANSLATE notes in localized file are lost.
Everything is not tested too much. I tried some random .dtd files from PM, tried some editing in Poedit (which I didn't even hear about until today) and so far, it seems to work fine. But there may be some unnoticed flaws for sure.