Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DDTP translations #16

Merged
merged 9 commits into from Aug 17, 2016
Merged

Support DDTP translations #16

merged 9 commits into from Aug 17, 2016

Conversation

iainlane
Copy link
Collaborator

Here's what we do here (requires libas master and my PR ximion/appstream#64 or an equivalent fix):

  • Split downloading into two entry points, which share a common backend (downloading to a given File). One for returning a string[], and the other for downloading to a given location on the filesystem.
  • Download InRelease and find all translations referenced in there (TODO: verify hashes - use libapt or something).
  • Download each translation and then set them on the DebPackage.
  • When finalizing, go over each language and set it on the Component. For this we need to turn off libas's fallback which always returns the C translations when a language isn't translated - that's the bit that requires libas master.

Style tips and other feedback appreciated.

if (match.empty)
continue;

if (!ret.data.canFind (match[1]))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no builtin set type, but that's what I really want here.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jup, I know and it's annoying - but you can use an associative array instead of a set.
See https://github.com/ximion/appstream-generator/blob/master/source/engine.d#L567 for an example.
(actually, we could make our own set type with this)

*
* Returns: The data if successful.
*/
string[] getFile (const string path, const uint retryCount = 5)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably rather be getFileContent because getFile makes me think I get a File or a filename back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants