Recent Posts
Best Practices for Using GNU Gettext for Flutter App Localization
Why Not Use Flutter’s Official I18n Solution
Recently, I started creating a globally multilingual mobile app in Flutter. The app needs to automatically display the interface in different languages based on the user’s region and language settings.
Since this is my first Flutter project, I naturally looked into the official solution provided by Google. However, once I saw it, first I laughed, then I cried.
Flutter’s official ARB file format requires you to predefine all the strings you want to translate as programmatic identifiers. Then, during the build process, it generates code that you can use in your program in an awkward way like this:
Compile Rust with cross-compilation and run the unit tests using QEMU
TL;DR
This post introduces a method to run unit tests for cross-compiled Rust programs on Linux using the
qemu-user-statictool.Why This Need?
Recently, while working on embedded Linux development with Rust, I needed to run unit tests on the target platform after cross-compiling the program to ensure quality. The challenge was that “qemu-user-static” can only translate and execute individual executable files, while Rust’s unit tests are typically run using
cargo test. To solve this, we need to compile the unit tests into one or more executable files for QEMU to run. By observing the execution process ofcargo test, I found that it actually compiles the unit tests into an executable program, but the name of this executable is appended with a hash of the source code. Therefore, in continuous integration environments, we need to determine the output executable file name.