Page MenuHomePhabricator

Retain custom attributes added to the resource tag for AndroidXmlFFS
Open, MediumPublic

Description

If certain attributes have been added to the <resources> tag in the XML file, on export these tags are being removed.

Eg: https://github.com/kiwix/kiwix-android/pull/1751/files#r374646202

We might want to preserving these.

Event Timeline

This should also take care of the second issue that was reported on the PR where the kiwix team wanted to add tools:ignore="all" to the qq file.

See: https://github.com/kiwix/kiwix-android/pull/1751#discussion_r374649627

A better approach might be to add a new configuration option via group configurations.

This is actually a bit hard as it is not easy to pass additional information from the parse to the generator. See T39168: Translate extension should not reparse Gettext definition files for GettextDocumentationAid.

Fixing this in a nice and performant way could be:

  • Add MessageGroup::loadWithMetadata() to provide access to all keys provided by FFS::read();
  • Store all that data in the cache
  • Modify export codes to pass thata data to FFS::write() in addition to the MessageCollection;

Other thoughts:

  • The usage of MessageGroupCache inside MessageGroupBase is not ideal. Maybe the MessageCollection construction should be moved out of the MessageGroup classes...
  • The name MessageGroupCache is confusing. Something like TranslationFileCache would be better (though still confusion between TranslationFile-Cache and Translation-FileCache).
  • MessageGroupCache still uses #keys-hack to iterate keys. CDB files provide native iteration that is faster and takes less disk space. Should check if that can be used here if some modifications to the format.

This is now technically possible (implemented for GettextFFS as an example).

abi_ lowered the priority of this task from High to Medium.Mar 30 2022, 1:11 PM

Currently not blocking any project so de-prioritizing it.