Using preexisting/system translations with gettext? -
I am writing a small program (javascript, but I do not think so) and it
The only string that needs to be translated is 'Minimum', 'Maximize', 'Restore', 'Close' etc. They should be translated anywhere, is not it? Since I right-click the window's system title bar, I get a menu with these very options (I'm using Linux).
Is there any way, I can use these previously translated translations to do them again (which translates to complete a few of the happy translators to volunteer for some time Looking for a group)?
Is it a matter of finding the right gettext domain? At this time I am setting it up at this time (this is in JavaScript but it is actually irrelevant to the question):
const Gettext = importorts.gettext.domain ('foobar-gettext - Domain'); Const _ = Gettext.gettext; OK, so on more reflection, I realized that I know that How to use the existing translation in the gatetext asdf , just do const Gettext = imports.gettext.domain (' Asdf '); Const _ = Gettext.gettext; No wonder.
It was found that my real problem wanted to use translations for "minimum", "maximize", "restore", "off", etc., and Although I was convinced that these translations were already present on my system, I did not know that the gettext domains were actually inside. To find it:
On Fedora (my versions are anyway), in the translated text / usr / share / locale . I went to / usr / share / locale / en_GB / LC_MESSAGES and there is a group of .mo files. These are not human-readable, but I can still flip through them: By looking through the list, it's up to me Date because when I'm looking for translation of items on the Window menu, then perhaps the owner of translations which is my window manager. My Window Manager (as I'm on the GNOME-Shell) is Pea , which is based on Metacity . So I downloaded Mater Sources and looked in the PO file (human-readable translation files), and take a look! #: ../src/ui/menu.c:69 Msgstr "Unwanted". Msgstr "Unwanted" #: Unma_ximise "... and so on (underscore keyboard accelerators for that menu item). So now I've got the translation, it's just (my Code):
const Gettext = imports.gettext .domain ('mater') const _ = Gettext.gettext; log in (_ ("(Ma_ximize")) To translate; // to 'ma_izmeet', (I will have to feed in _ ("Ma_ximize") gettext because it is the exact string that translates mutter.mo file - underscore bin There is no "enlarge" translation. I was subsequently removed from the translated text underscores, which can screw languages that can be used then In short, it is easy to use another (pre-existing) text domain, but the problem is that this problem can be traced back to the text domain whose string you want.
Comments
Post a Comment