Skip to content
This repository was archived by the owner on Feb 4, 2020. It is now read-only.

Commit 1ddd6d1

Browse files
committed
Merge branch 'master' into Ukrainian
2 parents 8b132df + a725f89 commit 1ddd6d1

30 files changed

Lines changed: 2615 additions & 22 deletions

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
.gradle
33
/local.properties
44
.idea
5+
/key.store
56
.DS_Store
67
/build
78
/captures
89
#/dictionary/words_from_aosp.xml
910
src/main/res/raw/*
1011
src/main/res/values/words_dict_array.xml
1112
LanguagePack-release.apk
13+
dictionary/words_merged.xml
14+
dictionary/words_from_aosp.xml
15+
dictionary/words_from_texts.xml
16+
17+
*.apk

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
This is the common template for language Packs for the [AnySoftKeyboard](https://github.com/AnySoftKeyboard/AnySoftKeyboard) app for Android devices.
2+
Each pack can contain and provide multiple keyboards or dictionaries for auto correction.
3+
Most packs are maintained here as [branches of the repository](https://github.com/AnySoftKeyboard/LanguagePack/branches) and published to Google Play Store and F-Droid repository. There are some packs maintained as community forks, here on GitHub or not open source at all. Some of these are:
4+
5+
* [NEO2](https://github.com/kertase/neo_anysoftkeyboard)
6+
* [Magyar (Hungarian)](https://github.com/rhornig/anysoftkeyboard-hungarian)
7+
* [Swiss](https://play.google.com/store/apps/details?id=ch.masshardt.anysoftkeyboard.swisslanguagepack)
8+
* [Pali (Indian)](https://github.com/yuttadhammo/ask-pali-keyboard)
9+
* [Malayalam, Kannada and other Indian](https://sriandroid.wordpress.com/)
10+
* [SSH](https://github.com/pi3ch/ssh_anysoftkeyboard)
11+
* [Dutch](https://github.com/OpenTaal/LanguagePack/tree/Dutch)
12+
13+
To start a new pack, follow this checklist:
14+
15+
1. Fork this repository.
16+
1. Create a new branch, name it after the language.
17+
1. In Android Studio, Refactor->Rename the folder/package com.anysoftkeyboard.languagepack.languagepack in the project tree, replacing the last `languagepack` with the name of the language. This will automatically change it at a couple of other locations.
18+
1. Change `applicationId` in `build.gradle` in the same way.
19+
1. Edit `src/main/res/xml/keyboards.xml` according to the comments in it. It references `src/main/res/xml/qwerty.xml`, so edit this as well. Have a look at all the other Language Pack branches, to get an idea, what is possible and how to correctly configure a keyboard.
20+
1. If you want to add more keyboards, you can do this by copying `qwerty.xml` and add a <keyboard> element in `keyboards.xml`. The user can pre-select in the ASK settings, which keyboards she would like to have available for toggling through.
21+
1. Edit `src/main/res/xml/dictionaries.xml`
22+
1. Edit `src/main/res/values/strings.xml`, change the strings there and possibly add some more which are referenced in the other xml files. Also, create a new folder `src/main/res/values-XX`, where `XX` is the correspondent two-letter ISO 639-1 language code.
23+
1. Edit (e.g. via Inkscape) one of the files in `src/main/svg-png/flag/` to represent the language, e.g. by using the flag from Wikipedia (the flag has to be placed on the right edge of the document and have the full height).
24+
1. Rebuild the drawables with `./gradlew svgToDrawablePng` or "Build" -> "Rebuild Project" in Android Studio. Drawables will be generated at `src/main/res/mipmap-*/`.
25+
1. Choose whether you like the standard or the broad variant and set that as application's `android:icon` in `src/main/AndroidManifest.xml`.
26+
1. You can also add a new `src/main/res/drawable/flag.png` and reference it in the `iconResId=""` attribute in the keyboards.xml.
27+
1. Put the source files for the dictionary into the dictionary/ directory. Take special care to take the conditions of the license into account, under which you obtained the data.
28+
1. Change the build.gradle to use and configure the tasks necessary. There are several different variants ([more Information](https://github.com/AnySoftKeyboard/AnySoftKeyboardTools/blob/master/README.md)):
29+
* `GenerateWordsListTask`
30+
* `GenerateWordsListFromAOSPTask`
31+
* `MergeWordsListTask`
32+
1. Change the README.md to reflect the characteristics of your pack
33+
1. Make some screenshots and replace the files in the `src/main/play/` folder. One of them should be a 1024x500 banner.
34+
1. If a branch of the language does not exist, [open an issue](https://github.com/AnySoftKeyboard/LanguagePack/issues/new) to request the creation of a new branch. As soon, as it is created, you can make a Pull Request from your forked branch to the one in the original repository. Provide translations of the following strings to your language:
35+
* title: "LANGUAGE Language Pack"
36+
* promo: "LANGUAGE language pack for AnySoftKeyboard"
37+
* description: "AnySoftKeyboard keyboards pack:
38+
LANGUAGE keyboard and dictionary.
39+
40+
This is an expansion pack for AnySoftKeyboard.
41+
Install AnySoftKeyboard first, and then select the desired layout from AnySoftKeyboard's Settings->Keyboards menu."
42+
43+
When it is merged, it can take a couple of days, until it is also distributed via Play Store and F-Droid.

StoreStuff/feature_graphics.png

-347 KB
Binary file not shown.

StoreStuff/store_hi_res_icon.png

-51 KB
Binary file not shown.

build.gradle

Lines changed: 123 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,76 @@
1+
import com.anysoftkeyboard.tools.generatewordslist.GenerateWordsListFromAOSPTask
2+
import com.anysoftkeyboard.tools.generatewordslist.GenerateWordsListTask
3+
import com.anysoftkeyboard.tools.generatewordslist.MergeWordsListTask
14
import com.anysoftkeyboard.tools.makedictionary.MakeDictionaryTask
5+
import fr.avianey.androidsvgdrawable.gradle.SvgDrawableTask
6+
import net.evendanan.versiongenerator.generators.EnvBuildVersionGenerator
7+
import net.evendanan.versiongenerator.generators.GitBuildVersionGenerator
8+
import net.evendanan.versiongenerator.generators.StaticVersionGenerator
9+
10+
System.setProperty("file.encoding", "UTF-8")
211

312
buildscript {
413
repositories {
14+
google()
515
jcenter()
16+
mavenCentral()
617
maven { url 'https://jitpack.io' }
18+
maven { url "https://plugins.gradle.org/m2/" }
719
}
820
dependencies {
9-
classpath 'com.android.tools.build:gradle:2.2.3'
21+
classpath 'com.android.tools.build:gradle:3.1.0-beta4'
1022

11-
classpath 'com.github.AnySoftKeyboard.AnySoftKeyboardTools:makedictionary:99bd3e6'
23+
classpath 'com.github.AnySoftKeyboard.AnySoftKeyboardTools:makedictionary:287fe7812294918636359e4d28dbcbc931f3dab8'
24+
classpath 'com.github.AnySoftKeyboard.AnySoftKeyboardTools:generatewordslist:287fe7812294918636359e4d28dbcbc931f3dab8'
25+
//classpath files('english_dictionary/generatewordslist-1.0-SNAPSHOT.jar')
1226
classpath 'org.jsoup:jsoup:1.9.1'
27+
28+
classpath 'com.github.Triple-T:gradle-play-publisher:8cda31a5d0e3c4f2d7f47ffde6fc3b370e59dd8a'
29+
30+
classpath 'com.github.menny:GradleVersion:0.0.4'
31+
32+
classpath('fr.avianey.androidsvgdrawable:gradle-plugin:3.0.0') {
33+
exclude group: 'xerces'
34+
}
1335
}
1436
}
1537

1638
apply plugin: 'checkstyle'
1739
apply plugin: 'com.android.application'
40+
apply plugin: 'com.github.triplet.play'
41+
apply plugin: 'net.evendanan.versiongenerator'
42+
apply plugin: "androidsvgdrawable"
43+
44+
45+
def generators = [
46+
new EnvBuildVersionGenerator.CircleCi(0,0),
47+
new GitBuildVersionGenerator(0,0),
48+
new StaticVersionGenerator()
49+
]
50+
51+
def versionData = versionGenerator.generateVersion(1, 0, 0, generators)
1852

1953
android {
20-
compileSdkVersion 25
21-
buildToolsVersion '25.0.2'
54+
compileSdkVersion 27
55+
buildToolsVersion '27.0.3'
2256

2357
defaultConfig {
2458
applicationId "com.anysoftkeyboard.languagepack.ukrainian"
25-
minSdkVersion 7
26-
targetSdkVersion 25
27-
versionCode 100
28-
versionName "2.0"
59+
minSdkVersion 9
60+
targetSdkVersion 27
61+
versionName versionData.versionName
62+
versionCode versionData.versionCode
63+
64+
// change name of generated apk to make previews and testing of multiple packs easier
65+
def packName = applicationId.substring(applicationId.lastIndexOf(".") + 1)
66+
setProperty("archivesBaseName", "ASKLangPack-${packName}-${versionCode}")
67+
68+
println "Building ${applicationId} v${versionName}, version-code ${versionCode}..."
2969
}
3070

3171
signingConfigs {
3272
release {
33-
storeFile file("key.store")
73+
storeFile file("/tmp/language_pack.keystore")
3474
storePassword System.getenv("PACK_KEYSTORE_PASSWORD")
3575
keyAlias System.getenv("PACK_KEYSTORE_ALIAS")
3676
keyPassword System.getenv("PACK_KEYSTORE_KEY_PASSWORD")
@@ -48,11 +88,35 @@ android {
4888
}
4989
}
5090

91+
play {
92+
track = 'alpha'
93+
serviceAccountEmail = System.getenv("PUBLISH_APK_SERVICE_ACCOUNT_EMAIL")
94+
pk12File = file('/tmp/apk_upload_key.p12')
95+
uploadImages = true
96+
}
97+
98+
//another option is to download the words-list from AOSP at https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/master/dictionaries/
99+
//make sure that you are using an unzipped file. The XX_wordlist.combined file should be a plain text file.
100+
task parseAospForEnglishDictionary(type: GenerateWordsListFromAOSPTask) {
101+
inputFile new File(project.getProjectDir(), "dictionary/aosp_en_wordlist.combined")
102+
outputWordsListFile new File(project.getProjectDir(), "dictionary/words_from_aosp.xml")
103+
maxWordsInList 300000
104+
}
105+
106+
task mergeAllWordLists(type: MergeWordsListTask) {
107+
//dependsOn parseTextInputFiles
108+
109+
inputWordsListFiles = [
110+
new File(project.getProjectDir(), "dictionary/words.xml"),
111+
new File(project.getProjectDir(), "dictionary/words_from_aosp.xml"),
112+
] as File[]
113+
outputWordsListFile new File(project.getProjectDir(), "dictionary/words_merged.xml")
114+
maxWordsInList 100000
115+
}
116+
51117
task makeDictionary(type: MakeDictionaryTask) {
52-
doFirst {
53-
mkdir 'src/main/res/raw'
54-
}
55-
inputWordsListFile new File(project.getProjectDir(), "dictionary/words.xml")
118+
dependsOn mergeAllWordLists
119+
inputWordsListFile new File(project.getProjectDir(), "dictionary/words_merged.xml")
56120
}
57121

58122
afterEvaluate { proj ->
@@ -65,14 +129,58 @@ afterEvaluate { proj ->
65129

66130
dependencies {
67131
repositories {
132+
google()
68133
jcenter()
69134
maven { url "https://jitpack.io" }
70135
}
71-
compile 'com.github.AnySoftKeyboard:AnySoftKeyboard-API:1.7.0'
136+
api 'com.github.AnySoftKeyboard:AnySoftKeyboard-API:1.10.0'
72137
}
73138

74139
task checkstyle(type: Checkstyle) {
75140
configFile file("${projectDir}/checkstyle/checkstyle.xml")
76141
source 'src'
77142
classpath = files()
78-
}
143+
}
144+
145+
// create app icon in all necessary sizes, automatically adding flag
146+
task svgToDrawablePng(type: SvgDrawableTask) {
147+
// specify where to pick SVG from
148+
from = files('src/main/svg-png/dummy')
149+
// specify the android res folder
150+
to = file('src/main/res')
151+
// create qualified directories if missing
152+
createMissingDirectories = true
153+
// override files only if necessary
154+
overwriteMode = 'ifModified'
155+
// generate PNGs for the following densities
156+
targetedDensities = ['ldpi', 'hdpi', 'mdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi']
157+
158+
outputFormat = 'PNG'
159+
outputType = 'mipmap'
160+
161+
// composition of SVGs
162+
svgMaskFiles = files('src/main/svg-png/mask-launcher')
163+
svgMaskResourceFiles = files('src/main/svg-png/flag')
164+
}
165+
166+
// create app icon in all necessary sizes, automatically adding flag
167+
task svgToDrawablePngPlay(type: SvgDrawableTask) {
168+
// specify where to pick SVG from
169+
from = files('src/main/svg-png/dummy')
170+
// specify the android res folder
171+
to = file('src/main/play/en-US/listing/icon')
172+
// create qualified directories if missing
173+
createMissingDirectories = true
174+
// override files only if necessary
175+
overwriteMode = 'ifModified'
176+
177+
outputFormat = 'PNG'
178+
outputType = 'raw'
179+
180+
// composition of SVGs
181+
svgMaskFiles = files('src/main/svg-png/mask-play')
182+
svgMaskResourceFiles = files('src/main/svg-png/flag')
183+
doLast {
184+
file('src/main/play/en-US/listing/icon/logo_launcher.png').renameTo(file('src/main/play/en-US/listing/icon/ask_logo.png'))
185+
}
186+
}

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ references:
77

88
container_config: &container_config
99
docker:
10-
- image: menny/android:1.7.1
10+
- image: menny/android:1.9.2
1111

1212
working_directory: *workspace_root
1313

gradle/wrapper/gradle-wrapper.jar

125 Bytes
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Feb 03 18:31:34 CET 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip

gradlew

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<!-- http://d.android.com/guide/practices/screens_support.html read about legacy. -->
1212

1313
<application
14-
android:icon="@drawable/app_icon"
14+
android:icon="@mipmap/ic_launcher"
1515
android:label="@string/app_name">
1616
<receiver
1717
android:name="com.anysoftkeyboard.languagepack.ukrainian.PackBroadcastReceiver"

0 commit comments

Comments
 (0)