This page is addressed to application developers who want to interface the Offline dictionaries app. It describes the available programming interfaces.
Android application
This part concerns the Android version of the application.
Start Intent
The application can be started by the following actions:
- nghs.intent.action.SEARCH: starts specifically the Offline dictionaries app
- colordict.intent.action.SEARCH: starts any dictionary app compatible with the ColorDict API (including Offline dictionaries)
- android.intent.action.SEND: generic send intent compatibility
Extra parameters can be added to the intent to perform a particular search:
Parameter name | Type | Description |
"dicID" | Integer |
Dictionary identifier, can be found in the dictionary file name (see below). If set, this will select the given dictionary (if installed). |
"keyword" or "EXTRA_QUERY" or Intent.EXTRA_TEXT |
String | Word or query, can contain wildcards (* for 0..n characters, ? for 1 character). If set, this will search for the given query in the current dictionary or the one identified by dicID. Examples: "test", "cat*", "he??o" |
Code example:
public static final String SEARCH_ACTION = "nghs.intent.action.SEARCH"; public static final String EXTRA_QUERY = "EXTRA_QUERY"; public static final String EXTRA_DICID = "dicID"; Intent intent = new Intent(SEARCH_ACTION); // parameters are optional intent.putExtra(EXTRA_QUERY, "word"); intent.putExtra(EXTRA_DICID, 1); startActivity(intent);
Custom dictionaries
This part describes dictionary format and how to build custom dictionaries.
Dictionary format
Dictionaries are SQLite3 databases. The SQL schema is the following:
CREATE TABLE dicmeta ( `name` TEXT NOT NULL , `value` TEXT NOT NULL , PRIMARY KEY (`name`) ); CREATE TABLE dicentry ( `id` INTEGER PRIMARY KEY, `key` TEXT NOT NULL COLLATE BINARY, `def` TEXT NOT NULL ); CREATE INDEX idx_key ON dicentry(key);
dicmeta table: dictionary meta information
Column name |
Type | Description |
name | TEXT |
Name of the meta entry, can be one of the following:
|
value | TEXT | Value of the meta entry. |
dicentry table: dictionary entries
Column name |
Type | Description |
id | INTEGER |
Primary key of the record. |
key | TEXT | Defined word, lower case UTF-8. |
def | TEXT | Definition for "key". Format depends on the "defformat" meta parameter:
|
Creating a custom dictionary
To create a custom dictionary, first create a SQLite database with the SQL schema described above. Then fill the dicentry table.
Fill the dicmeta table as well, with at least the following entries:
- id: choose an unique identifier for your dictionary. Custom dictionary id must be greater than 10000.
- version: version of your dictionary, starts at 0.
- defformat: format of the dicentry.def column. Can be "text" or "html".
- name: name of the dictionary.
- copyright: copyright information.
- entryCount: number of entries in dicentry.
- langFrom: ISO 639-1 language code (2 characters) used in the dicentry.key column.
- langTo: ISO 639-1 language code (2 characters) used in the dicentry.def column.
To finish, rename your dictionary to dic_<id>.ddb and copy it to /sdcard/DictionariesNGHS/.
Dictionary identifiers
Here is the list of the dictionary identifiers for dictionaries provided with the application:
- English (WordNet): 12- English (Wiktionary): 76
- English (1913): 3
- German (Wiktionary): 62
- Korean: 41
- French (Wiktionary): 75
- Spanish (Wiktionary): 32
- Italian (Wiktionary): 77
- Korean (Hanja / Hanzi): 40
- French (academy, 8th ed.): 2
- French (Littré 1877): 46
- Korean (Law): 43
- Irish (synonyms): 37
- English synonyms (US, WordNet): 35
- German (synonyms): 34
- French (synonyms): 33
- Polish (synonyms): 38
- English (synonyms): 4
- Spanish (synonyms): 36
- Czech (synonyms): 39
- French (anagrams): 74
- English (anagrams): 73
- French word list: 50
- English word list: 72
- German-Russian: 31
- Russian-German: 30
- Japanese-English: 49
- English-Japanese: 48
- German-Japanese: 98
- Japanese-German: 54
- English-Chinese: 45
- Chinese-English: 9
- German-French: 23
- French-German: 24
- Dutch-Japanese: 128
- Japanese-Dutch: 127
- English-Russian: 11
- Russian-English: 10
- English-Hindi: 68
- Hindi-English: 69
- English-French: 1
- French-English: 0
- Arabic-English: 27
- English-Arabic: 15
- German-English: 6
- English-German: 5
- English-Korean: 44
- Korean-English: 42
- Japanese-Italian: 100
- Italian-Japanese: 99
- Japanese-Spanish: 129
- Spanish-Japanese: 130
- Spanish-French: 19
- French-Spanish: 20
- Japanese-French: 13
- French-Japanese: 67
- German-Spanish: 79
- Spanish-German: 83
- Spanish-English: 7
- English-Spanish: 8
- Italian-English: 28
- English-Italian: 29
- Italian-French: 25
- French-Italian: 26
- German-Italian: 78
- Italian-German: 81
- French-Chinese: 52
- Chinese-French: 51
- Dutch-French: 66
- French-Dutch: 65
- French-Russian: 55
- Russian-French: 56
- Portuguese-French: 95
- French-Portuguese: 94
- Portuguese-English: 14
- English-Portuguese: 16
- German-Polish: 92
- Polish-German: 93
- German-Portuguese: 96
- Portuguese-German: 97
- Dutch-English: 106
- English-Dutch: 105
- Spanish-Russian: 84
- Russian-Spanish: 80
- Portuguese-Spanish: 118
- Spanish-Portuguese: 113
- Japanese-Russian: 102
- Russian-Japanese: 101
- Italian-Russian: 59
- Russian-Italian: 60
- Chinese-Russian: 53
- German-Dutch: 103
- Dutch-German: 104
- French-Arabic: 63
- Arabic-French: 64
- Portuguese-Russian: 116
- Russian-Portuguese: 109
- Polish-French: 91
- French-Polish: 90
- Italian-Spanish: 82
- Spanish-Italian: 85
- German-Turkish: 108
- Turkish-German: 121
- Polish-English: 89
- English-Polish: 88
- Korean-French: 139
- French-Korean: 131
- Turkish-English: 125
- English-Turkish: 115
- Italian-Portuguese: 111
- Portuguese-Italian: 117
- Polish-Russian: 87
- Russian-Polish: 86
- Russian-Korean: 133
- Korean-Russian: 141
- Turkish-French: 120
- French-Turkish: 107
- Walloon-French: 61
- Turkish-Russian: 122
- Russian-Turkish: 110
- Portuguese-Korean: 136
- Korean-Portuguese: 144
- German-Korean: 132
- Korean-German: 140
- Spanish-Korean: 135
- Korean-Spanish: 143
- Turkish-Portuguese: 126
- Portuguese-Turkish: 119
- English-Hebrew: 17
- Hebrew-English: 18
- Italian-Korean: 134
- Korean-Italian: 142
- Czech-French: 21
- French-Czech: 22
- Turkish-Korean: 138
- Korean-Turkish: 145
- Hindi-French: 71
- French-Hindi: 70
- Turkish-Spanish: 124
- Spanish-Turkish: 114
- Hindi-Portuguese: 146
- Portuguese-Hindi: 137
- Italian-Turkish: 112
- Turkish-Italian: 123