artetxem / mitzuli

The open, easy-to-use and powerful translator app for Android
http://www.mitzuli.com
GNU General Public License v2.0
162 stars 67 forks source link

Support for adding new language pairs #34

Open sunilsunny565 opened 7 years ago

sunilsunny565 commented 7 years ago

I am trying to compile new language pairs from apertium. I was able to compile the language pairs but had only data and modes, don't know where to find the class.jar file. I really like to use the same format in which this app is using the language pairs. What is the signature in manifest file ? ,how can I edit public_key.der to add new files?. Any help is greatly appreciated .If I am successfull I am happy to contribute to mitzuli. Fom what can I see there are new language pairs http://apertium.projectjj.com/win32/nightly/data.php.

artetxem commented 7 years ago

The format of the language pair packages is almost the same as that used by Apertium, which is documented at http://wiki.apertium.org/wiki/Language_pair_packages. Some differences:

  1. Mitzuli uses a separate package for each translation direction, while Apertium uses a single package for each language pair (possibly including more than one direction/variant)
  2. Mitzuli packages are Android specific, whereas Apertium packages support more platforms (and as such include more stuff within them)
  3. Mitzuli uses a more complex manifest system, including the package signature mechanism that you mention

This has not been properly documented yet, but you can easily see the differences by downloading a Mitzuli package and an Apertium package and comparing them side by side. The script and instructions to create Apertium packages should serve for Mitzuli with minor modifications. I do have some scripts for package maintenance, but would not be very helpful for somebody else as they are.

Regarding the signature in the manifest file, note that Mitzuli/Apertium packages include Java bytecode that is used for transfer, making them vulnerable to code injection attacks (an attacker could inject arbitrary bytecode when the user downloads a language pair or once it is in the file system, and this code would be run by the app). The signing mechanism protects against this type of attacks by verifying the integrity of the packages. Put it simple, every time I publish a language pair I sign it with a "secret" private key and set the signature in the manifest file accordingly. When the app loads a package it verifies that it was indeed signed by my "secret" key using its corresponding public key. public_key.der contains this public key, and should be created together with the private key if you want to maintain a separate package repository (unlikely unless you want to create a complete fork). In any case, package signing can be disabled in the app settings.

If all you wanted was to see those missing language pairs in Mitzuli, note that most of them (if not all) are incompatible with Android. I think that you yourself created an issue on this in the Apertium repo ;) In any case, it is true that I haven't updated the language pairs for a very long time, I will do it when I get some time.

sunilsunny565 commented 7 years ago

Thanks for the detailed explanation. And also I was able to add new language pairs (Without signature verification). As you said just find out some of them are not compatible with android the hard way :) .Anyway thanks for this wonderful project ,it's really helpful.

trymeouteh commented 5 years ago

Please add these languages

English-French English-German English-Russian English-Ukraine