Internationalization of Text Strings with Emacs

科技动态 2018-06-20 阅读原文

I’ve had this topic in my blog queue for a couple of weeks but I noticed literally scores of tweets pointing to the post in question. That was enough to make me forego my own post on the subject but on rereading the original post, I realized there are some good ideas in it regardless of what’s going on with the tweets.

The post, by Dylan Kirby of MojoTech
, discusses to problem of internationalizing text strings
in an application that will be used in more than one country. Kirby discusses the problem in terms of the React framework but almost exactly similar problems occur anywhere you need internationalization. I’ve done my share of that in C where we used the GNU gettext
library. It’s always a pain and, truth to tell, I avoided working on it whenever I could slough it off to my colleagues. I’m a bad person, I know.

Regardless, Kirby and his colleagues were stuck with doing it and he noticed that it was mostly repetitive work. They used Google Translate
to provide a first order translation that was later refined by a human translation service so a first hack at the translation could be automated along with the rest of the mechanics.

You can get the details from Kirby’s post but the most important lesson from his account for me is that it serves as an answer to why you might prefer an Emacs “lisp-machine-like” environment to the pure editing environment of Vim. Kirby’s problem is representative of a common class of problems that are easy to automate with Emacs. My Vim-foo is rusty enough that I don’t see an easy way to do the same thing in Vim, especially the querying of Google Translate. You can argue that you don’t want to read emails in Emacs or use it to listen to music but, believe me, if you have to deal with internationalization, you’ll be happy to have a way of automating it as much as possible. It’s just one more reason that I’m glad to be an Emacs user.




f-strings in emacs-lisp I am a big fan of f-strings in Python 3. They let you put variable names and expressions in a string template that get expanded to create new strin...
Using Emacs 37 – Treemacs file browser I've been meaning to get back to making Emacs videos but I've been having trouble figuring out what to record. People have asked for Magit but I...
Pancake – a CLI/Emacs web/gopher/file browser Pancake is a CLI/Emacs web/gopher/file browser. It utilizes pandoc and external downloaders such as curl , adding support for Gopher directories an...
Optimising Dash.el Dash.el is a lovely library, and one of the most popular on MELPA. If we can squeeze every last drop of performance out of it, everyone benefits. Le...
Line Numbers in Emacs 26.1 As you’ve probably heard, Emacs 26.1 has replaced the old linum-mode with a faster and less cluttered implementation. I almost never need or want lin...