words.hk dictionary for Android and iOS
In your Cargo.toml
, ensure the following crate-type
is present:
[lib]
crate-type = ["staticlib", "cdylib"] # "staticlib" for iOS, "cdylib" for Android
We use the SMTP protocol to anonymously report bugs to the developers. If you wish to
receive bug reports via email, add lib/smtp_credentials.dart
with the following variables:
String host = 'YOUR SMTP HOST'; // eg: 'smtp.mailgun.org'
String username =
'YOUR SMTP USERNAME'; // eg: '[email protected]';
String password = 'YOUR SMTP PASSWORD';
String recipient = 'YOUR DEVELOPER EMAIL ADDRESS'; // eg: '[email protected]'
If you are not interested in the bug reports, add lib/smtp_credentials.dart
with
following content:
// Turns off SMTP bug reporting
String host = '';
String username = '';
String password = '';
String recipient = '';
Install Android NDK in Android Studio:
Android Studio > Tools > SDK Manager > SDK Tools > NDK (Side by side)
Install Cargo NDK for Android:
cargo install cargo-ndk --version ^2.7.0
See here for potential caveats.
Download the Android targets for Rust:
rustup target add armv7-linux-androideabi
rustup target add aarch64-linux-android
Install Cargo lip for iOS:
cargo install cargo-lipo
Download the ios targets for Rust:
rustup target add x86_64-apple-ios
rustup target add aarch64-apple-ios
Until this issue is fixed, we need to use an older version of flutter_rust_bridge_codegen.
cargo install flutter_rust_bridge_codegen --version=1.34.2
Install ffigen
flutter pub add --dev ffigen && flutter pub add ffi
dart pub global activate ffigen
Give the build script execution permission:
chmod +x ./build_rust.sh
Run the build script to build Rust for Android and iOS:
./build_rust.sh
If you are building this app on an M1 mac, you may need to run the following line before running flutter run
:
sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc
- Update the version of
flutter_rust_bridge
inpubspec.yaml
- Update the version of
ffigen
inpubspec.yaml
if not updated automatically - Update the version of
flutter_rust_bridge
inrust/Cargo.toml
to the same version as (1) - Run
dart pub global activate ffigen
to activate updated ffigen - Run
./build_rust.sh
and fix any compiler error - Run
flutter clean
to clean build files - Restart flutter using
flutter run
The build script first generate a glue code that bridges Rust and Dart code using flutter_rust_bridge.
The build script then generate a release version of the iOS binary:
cargo lipo --release && cp target/universal/debug/libwordshk_api.a ../ios/Runner
If the release build is too slow, you can replace the above line in the build script with this instruction for running a debug build:
cargo lipo && cp target/universal/debug/libwordshk_api.a ../ios/Runner
The build script then generate a release version of the Android binary.
cargo ndk -o ../android/app/src/main/jniLibs build --release
If the release build is too slow, you can replace the above line in the build script with this instruction for running a debug build:
cargo ndk -o ../android/app/src/main/jniLibs build
See this tutorial to set up Android.
Run snapshot:
bundle exec fastlane snapshot --configuration "Release" --stop_after_first_error
Reset all simulators in case of errors during snapshot:
bundle exec fastlane fastlane snapshot reset_simulators
-
Open Adobe Audition, run the "Match Loudness" with these settings:
- ITU-R BS.1770-3 Loudness
- Target Loudness: -16 LUFS
- Tolerance: 2 LU
- Max True Peak Level: -2 dBTP
- Look-ahead Time: 12ms
- Release Time: 200ms
-
Export the files with matched loudness With export settings as follows:
- Format MP3
- Sample Type: Same as source
- Format settings: MP3 24 Kbps CBR (Constant type)
-
Change directory into
assets/jyutping_female
orassets/jyutping_male
. -
Run
process_audios.sh
. This script does three things:- Trim silence at the beginning and end of all mp3 files
- Pad the end of jap6sing1 syllables so they are not too short
- Peak normalize jap6sing1 syllables to make they as loud as other syllables
- Show jyutping help before search or suggestions for fix during search
- Add spell checker suggestion to english search
- Use word match percent instead of direct lookup for phrases with >1 words
- Test multi-language support for entries
- Add auto language detection for searches
- Show possible jyutping when search result is not found.
- Offer option to show entries in simplified
- Wait for fast2s to merge my 乾/干 PR and update to use the new version
- Make text selection in entries smoother
- Fix ruby positioning in Entry M/jam's : "好M唔M,M套?"
- Customize keyboard bar for iOS and Android using https://pub.dev/packages/keyboard_actions
- Cut off audio when switching audio or exiting page
- Add Yale romanization support
- Convert traditional characters in links of eng explanation to simplified
- Convert traditional characters in result not found to simplified
Software: Copyright (C) 2022 Xiang Li, licensed under the MIT license. Dictionary: Copyright (C) 2014-2022 Hong Kong Lexicography Limited.
"words.hk", "wordshk", "粵典" are trade names of Hong Kong Lexicography Limited. Permission by Hong Kong Lexicography Limited must be obtained to promote or distribute materials containing these names. In particular, notwithstanding any permission (if applicable) to redistribute the source code of this project and/or its derivative works by the copyright owner(s), unless you obtain explicit permission from Hong Kong Lexicography Limited, you are required to remove all mentions of "words.hk", "wordshk", "粵典" from your redistributions.
The dictionary contents published by words.hk is copyrighted by Hong Kong Lexicography Limited. You may be eligible to obtain a license from https://words.hk/base/hoifong/