2023-06-07 (Updated 2023-07-29)
Update: On latest version of SwayWM, everything works OOTB with Fcitx5
To input CJK (Chinese, Japanese and Korean) languages in Linux Minecraft, you can install this mod CocoaInput.
If that's the case, I won't bother writing an article about it. The thing is that the mod is only officially available for 1.7 to 1.18, for the latest Minecraft 1.19 to 1.20, you'll need to compile the mod binary from an updated fork of it.
Head to this GitHub repo for the source code.
# clone the repo
git clone https://github.com/nakanotti/CocoaInput
cd CocoaInput
The mod needs Xlib as build dependency. For fedora:
sudo dnf install libX11-devel
sh build_lib_for_x11.sh
cd fabric
chmod u+x gradlew # the gradle binary is not executable by default, you need to make it executable manually.
./gradlew build

The build process took 8 mins for me. After compiling, you can remove the build dependency. For Fedora:
sudo dnf remove libX11-devel

The built mod is generated at build/libs. Copy the mod to mc's mod folder, and you should be able to use it.