site  contact  subhomenews

bluetoothctl utility internationalized

October 28, 2020 — BarryK

Several hours ago, I posted about a simple method to internationalize any C program:

https://bkhome.org/news/202010/how-to-internationalize-any-c-program.html

And I suggested would do it to the 'bluetoothctl' utility. Yep, have done it.

I downloaded the 'bluez' 5.54 source, and internationalized files in the "client" folder. Here is the patch:

bluez-5p54-bluetoothctl-internationalize.patch.gz

The internationalization is conservative. Some strings were a bit too complicated, so left them alone. Also, did not translate user-input prompt strings -- reason is, I might want to parse the bluetoothctl output log to detect those strings. An example would be something like "Enter PIN code:", or "Clone [yes|no]:" -- BluePup can detect these and provide translated guidance.

This is how the 'bluetoothctl.pot' file was generated:

# cd client
# xgettext -d bluetoothctl -s --no-wrap -o bluetoothctl.pot --keyword=_ main.c gatt.c advertising.c agent.c

...I edited the file and changed the character type to "UTF-8".

Here is the PET, with only /usr/bin/bluetoothctl and /usr/share/doc/nls/bluetoothctl/bluetoothctl.pot in it (89KB):

http://distro.ibiblio.org/easyos/amd64/packages/pet/pet_packages-dunfell/bluetoothctl-5.54-internationalized-dunfell64.pet

It was compiled in Easy Dunfell 0.95 and I can't guarantee that the PET will work in other distros. If you want to compile the source yourself, this was my configure:

# ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --build=x86_64-pc-linux-gnu --enable-library --disable-systemd 

Tags: easy