Skip to content

Latest commit

 

History

History
83 lines (73 loc) · 6.14 KB

CONTRIBUTING.md

File metadata and controls

83 lines (73 loc) · 6.14 KB

AnySoftKeyboard Add-On Packs

Each language is a set of two modules, pack and apk. pack is an Android library that holds all the information about the language pack (keyboards, dictionaries, receivers, etc.), while apk bundles that into an installable (and publishable) APK. General information about how to create a fork and pull-request could be found here: https://www.dataschool.io/how-to-contribute-on-github/

How to create a Language-Pack

Let's say you want to create a language-pack for Klingon. We'll call the pack klingon, and its locale is kl.

  1. Easiest way to start, is to duplicate one of the other packs: cp -R english klingon.
  2. Add the new modules to Gradle. Edit settings.gradle, add the line:
include ":addons:languages:klingon:pack", ":addons:languages:klingon:apk"
  1. At this point, you'll need to sync your Android Studio project.
  2. Rename the package names (com.anysoftkeyboard.english.* -> com.anysoftkeyboard.klingon.*:
    • Change package value in AndroidManifest.xml files (one in pack and the second in apk).
    • Move the PackBroadcastReceiver package to the right place.
  3. Rename the english_keyboards.xml and english_dictionary.xml files (under klingon/pack/src/main/res/xml) to klingon_keyboards.xml and klingon_dictionaries.xml.
  4. Replace the dictionary files under klingon/pack/dictionary with inputs matching your language (and remove what's not relevant):
    • Try to locate AOSP dictionary files (could be found at AOSP, or LineageOS) (you should use the XX_wordlist.combined.gz file).
    • If you have anything that was pre-built into a word-list XML, put those under klingon/pack/dictionary/prebuilt.
    • Add text files that will be parsed - word-counted - to generate word-list XMLs
    • If you do not want to generate a dictionary, then disable that in klingon/pack/gradle.build by adding: ext.shouldGenerateDictionary = false
  5. Generate the dictionary: ./gradlew :addons:languages:klingon:pack:makeDictionary. This will create the following files (which should not checked into the repo):
    • raw resources under klingon/pack/src/main/res/raw/klingon_words_?.dict
    • IDs resource array under klingon/pack/src/main/res/values/klingon_words_dict_array.xml
    • If you have problems with the windows encoding, create the Environment Variable JAVA_TOOL_OPTIONS with the value -Dfile.encoding=UTF8.
  6. Edit klingon_dictionaries.xml:
    • to point to the new array resource @array/klingon_words_dict_array
    • replace the id with a new GUID.
    • replace name and description
    • replace the locale
  7. Set the status-bar icon text at klingon/pack/build.gradle: ext.status_icon_text = "kl"
  8. If this is an initial publish (as in, a new language pack) then disable the publish in klingon/apk/build.gradle:
  • ext.shouldBePublished = false
  • ext.notPublishingReason = "Initial version has not been published yet"
  1. Replace the flag at klingon/apk/flag with a, high-quality, png or svg, image of the flag. It should be named flag.png or flag.svg. Note that sometimes svg files are not converted correctly, but they will produce highest quality if successful.
  2. To generate the icons, you'll need ImageMagick installed on your path. Check out the installation page for details.
  3. Generate the icons: ./gradlew :addons:languages:klingon:pack:generateLanguagePackIcons :addons:languages:klingon:apk:generateStoreLogoIcon. This will generate the following files (which should be checked into the repo):
    • klingon/pack/src/main/res/drawable-*/ic_status_klingon.png
    • klingon/apk/src/main/res/mipmap-*/ic_launcher.png
    • klingon/apk/src/main/play/listings/en-US/graphics/feature-graphic/pack_store_feature_graphics.png
    • klingon/apk/src/main/play/listings/en-US/graphics/icon/pack_store_icon.png
  4. Edit the keyboard layouts to your language, remove what's not needed, and add new ones if you need. Make sure the names of the layouts include your pack-name (klingon).
  5. Edit klingon_keyboards.xml. For each of the layouts you want in your pack (the layouts you created in the previous step):
    • Generate a new GUID.
    • Set the locale value at defaultDictionaryLocale to match the value you used in klingon_dictionaries.xml.
    • Set the status-bar icon at iconResId to the generate icon @drawable/ic_status_kl
    • Update the texts (name and description).

At this point, you should be able to build an APK that can be installed on your device:

./gradlew :addons:languages:klingon:apk:assembleDebug

on successful build the apk could be found at outputs\apks\debug or directly install it on your connected device:

./gradlew :addons:languages:klingon:apk:installDebug

Iterate on your pack until you feel it is good, and then create a PR to merge it to the main branch.

Publish pack

You can either publish by yourself, under your developer account and keep complete ownership, or you can let us (aka AnySoftKeyboard organization) do it.

Play Store Publish by AnySoftKeyboard organization

First, the pack needs to be owned by the AnySoftKeyboard developer account. Second, the initial release needs to be manually done by one of the account owners. Third, mark the :addons:languages:[pack]:apk module as publishable:

ext.shouldBePublished = true

and remove the notPublishingReason field. After this is merged, the pack will be automatically released by our CI/CD pipelines.

Alpha and Beta releases

  • alpha releases are closed-testing, meaning that you will need to ask to be added to the list of testers.
    • To support alpha releases, add ext.closedTestingTrackName = 'alpha' to the build file.
  • beta releases are open-testing, meaning anyone can join them.
    • To support beta releases, add ext.openTestingTrackName = 'beta' to the build file.