1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
|
<HTML>
<HEAD>
<!-- Created with AOLpress/2.0 -->
<!-- AP: Created on: 19-Aug-2006 -->
<!-- AP: Last modified: 25-Sep-2008 -->
<TITLE>User Interface Translation Notes</TITLE>
<LINK REL="icon" href="ffanvil16.png">
<LINK REL="stylesheet" TYPE="text/css" HREF="FontForge.css">
</HEAD>
<BODY>
<DIV ID="in">
<H1>
User Interface Translation Notes
</H1>
<BLOCKQUOTE ID="lit">
<TABLE ID="lit" ALIGN="RIGHT">
<TR VALIGN="Bottom">
<TD COLSPAN=2><SMALL><SMALL><B>CASCA:</B></SMALL> Ay, he spoke Greek.<BR>
<SMALL><B>CASSIUS:</B></SMALL> To what effect?<BR>
<SMALL><B>CASCA:</B></SMALL> Nay, an I tell you that, I'll ne'er<BR>
look you i' the face again: but those that<BR>
understood him smiled at one another and<BR>
shook their heads; but, for mine own<BR>
part, it was Greek to me.</SMALL></TD>
<TD><SMALL><SMALL><I>Julius Caesar</I>, I, ii<BR>
Shakespeare</SMALL></SMALL></TD>
</TR>
<TR>
<TD COLSPAN=3>
<HR>
</TD>
</TR>
<TR VALIGN="Bottom">
<TD><SMALL><SMALL><B>CHAPLAIN:</B></SMALL>...legal matters and so forth<BR>
Are Greek to me; except of course<BR>
That I understand Greek.</SMALL></TD>
<TD COLSPAN=2><SMALL><SMALL><I>The Lady's not for Burning</I>, II<BR>
Christopher Fry</SMALL></SMALL></TD>
</TR>
</TABLE>
</BLOCKQUOTE>
<P>
FontForge uses a standard mechanism called gettext to provide translations
of user interface strings into different language. Gettext is described profusely
at the <A HREF="http://www.gnu.org/software/gettext/manual/">gettext site</A>,
the following are some brief notes on what you need to know to translate
FontForge's UI.
<UL>
<LI>
<A HREF="uitranslationnotes.html#Obtaining">Obtaining the strings</A>
<LI>
<A HREF="uitranslationnotes.html#Modifying">Creating and Modifying a "po"
file</A>
<LI>
<A HREF="uitranslationnotes.html#Updating">Updating an already existing "po"
file</A>
<LI>
<A HREF="uitranslationnotes.html#Testing">Testing a "po" file</A>
<LI>
Examples,
<A HREF="http://fontforge.git.sourceforge.net/git/gitweb.cgi?p=fontforge/fontforge;a=summary">browse
the git repository for the "po" directory</A>
<LI>
<A HREF="#More">Still more strings to translate!</A>
<LI>
<A HREF="#HotKeys">Different hot keys</A>
</UL>
<P>
<BR CLEAR="ALL">
<H2>
<A NAME="Obtaining">Obtaining</A> the strings
</H2>
<P>
In a gettext based package, the translatable strings live in a "pot" file.
In FontForge's case it is called "FontForge.pot".
<P>
You can download the <A href="FontForge.pot.bz2">current version of this
file from here;</A> it will be updated at least each time I make a release
and possibly more frequently.
<!--<P>
Each source distribution I make contains the then current FontForge.pot file
in the top level directory of the distribution. You may find a copy of the
<A HREF="http://sourceforge.net/project/showfiles.php?group_id=103338&amp;amp;amp;amp;amp;amp;package_id=114328">current
distribution on sourceforge</A>, it will be called something like
fontforge_full-20060817.tar.bz2.-->
<P>
After you have downloaded one of these packages, either copy the tarball
to where you are, or move to the directory containing the tarball (I can't
provide explicit instructions here, because I don't know where your browser
put the file) and type (do not type "$"):
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>bunzip2 FontForge.pot.bz2
</PRE>
</BLOCKQUOTE>
<P>
Then edit the file<CODE> FontForge.pot</CODE>.
<H4>
from the <A NAME="src-git">git</A> repository
</H4>
<P>
This is a better solution because it gives you a current version of the pot
file. Create a git repository as described in the
<A HREF="source-build.html#src-git">section on building from source</A>.
Having done that type
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>cd fontforge
<FONT COLOR="Gray">$ </FONT>make -f Makefile.in FontForge.pot
</PRE>
</BLOCKQUOTE>
<BLOCKQUOTE ID="lit">
<TABLE ID="lit" ALIGN="RIGHT">
<TR>
<TD><SMALL>The Bellman looked uffish, and wrinkled his brow,<BR>
`If only you'd spoken before!<BR>
It's excessively awkward to mention it now,<BR>
With the Snark, so to speak, at the door!'</SMALL>
<P>
<SMALL> `We should all of us grieve, as you may well believe<BR>
If you never were met with again-<BR>
But surely, my man, when the voyage began<BR>
You might have suggested it then?'</SMALL>
<P>
<SMALL> `It's excessively awkward to mention it now<BR>
As I think I've already remarked.'<BR>
And the man they called "Hi!" replied with a sigh,<BR>
`I informed you the day we embarked.'</SMALL>
<P>
<SMALL> `You may charge me with murder- or want of sense-<BR>
(We are all of us weak at times):<BR>
But the slightest approach to a false pretense<BR>
Was never among my crimes!'</SMALL>
<P>
<SMALL> `I said it in Hebrew- I said it in Dutch-<BR>
I said it in German and Greek:<BR>
But I wholly forgot (and it vexes me much)<BR>
That English is what you speak!'</SMALL></TD>
</TR>
<TR>
<TD><I><SMALL><SMALL>The Hunting of the Snark</SMALL></SMALL></I>,<SMALL>
<SMALL>Lewis Carroll</SMALL></SMALL></TD>
</TR>
</TABLE>
</BLOCKQUOTE>
<H2>
Creating and <A NAME="Modifying">Modifying</A> a "po" file
</H2>
<P>
You should now have a FontForge.pot file (if you don't see the
<A HREF="uitranslationnotes.html#Obtaining">above section</A> on how to get
one).
<P>
The pot file is in the same format as the "po" file which you need to generate.
Simply rename FontForge.pot to the language/locale that you are working on.
In most cases you will probably want to rename it just to the language
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>mv FontForge.pot <FONT COLOR="Red">fr</FONT>.po
</PRE>
</BLOCKQUOTE>
<P>
But sometimes that will not be enough. For example, Traditional and simplified
chinese are sufficiently different that a locale must also be specified:
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>mv FontForge.pot <FONT COLOR="Red">zh_TW</FONT>.po
</PRE>
</BLOCKQUOTE>
<P>
Once you have created your po file it is time to start modifying it. I shall
use French as an example in the following (because I almost speak French),
obviously you will need to make changes appropriate for your language.
<P>
The po file begins with some lines like:
<BLOCKQUOTE>
<PRE># (American) English User Interface strings for FontForge.
# Copyright (C) 2000-2006 by George Williams
# This file is distributed under the same license as the FontForge package.
# George Williams, <pfaedit@users.sourceforge.net>, 2006.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2006-08-19 07:32-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
</PRE>
</BLOCKQUOTE>
<P>
You should change this to:
<BLOCKQUOTE>
<PRE># <FONT COLOR="Red">(French) French</FONT> User Interface strings for FontForge.
# Copyright (C) <FONT COLOR="Red">2004-2006 by Pierre Hanser & Yannis Haralambous</FONT>
# This file is distributed under the same license as the FontForge package.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: <FONT COLOR="Red">20060821</FONT>\n"
"POT-Creation-Date: 2006-08-19 07:32-0700\n"
"PO-Revision-Date: <FONT COLOR="Red">2006-08-20 14:46+0100</FONT>\n"
"Last-Translator: <FONT COLOR="Red">Pierre Hanser</FONT>\n"
"Language-Team: <FONT COLOR="Red">French</FONT> <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=<FONT COLOR="Red">UTF-8</FONT>\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=<FONT COLOR="Red">2</FONT>; plural=<FONT COLOR="Red">n>1</FONT>;\n"
</PRE>
</BLOCKQUOTE>
<P>
Most of these are pretty self-explanatory. Fill in your name and email address
where appropriate, and the date on which you last worked on the file. The
plurals line is a little more complex, and I'll describe it
<A HREF="uitranslationnotes.html#plurals">later</A>.
<P>
Next there are thousands of string entries. They look something like this:
<BLOCKQUOTE>
<PRE>#: ttfinstrs.c:2184 typofeatures.c:1450 ../gdraw/gaskdlg.c:1076
#: ../gdraw/gaskdlg.c:1332 ../gdraw/gaskdlg.c:1391 ../gdraw/gfiledlg.c:152
#: ../gdraw/gmatrixedit.c:711 ../gdraw/gsavefiledlg.c:280
msgid "_Cancel"
msgstr ""
</PRE>
</BLOCKQUOTE>
<P>
You should change these to:
<BLOCKQUOTE>
<PRE>#: ttfinstrs.c:2184 typofeatures.c:1450 ../gdraw/gaskdlg.c:1076
#: ../gdraw/gaskdlg.c:1332 ../gdraw/gaskdlg.c:1391 ../gdraw/gfiledlg.c:152
#: ../gdraw/gmatrixedit.c:711 ../gdraw/gsavefiledlg.c:280
msgid "_Cancel"
msgstr "<FONT COLOR="Red">_Annuler</FONT>"
</PRE>
</BLOCKQUOTE>
<P>
So the translation goes into the msgstr line. (The comment lines above indicate
in what source files and on what lines the "_Cancel" string is used -- this
information may be helpful if you want more information about context). If
you don't want to translate a string just leave the msgstr as a null-string,
and the English text will be used ("OK" seems to be left untranslated in
many languages)
<BLOCKQUOTE>
<PRE>#: ttfinstrs.c:2184 typofeatures.c:1450 ../gdraw/gaskdlg.c:1076
#: ../gdraw/gaskdlg.c:1332 ../gdraw/gaskdlg.c:1391 ../gdraw/gfiledlg.c:152
#: ../gdraw/gmatrixedit.c:711 ../gdraw/gsavefiledlg.c:280
msgid "_OK"
msgstr ""
</PRE>
</BLOCKQUOTE>
<P>
Some strings contain mnemonics. The mnemonic is preceded by an underscore.
<P>
That seems fairly straight forward. But there are always complications. Sometimes
an English word might be translated by different French words depending on
context. For example in French the English word "New" might be translated
as either "Nouveau" or "Nouvelle" depending on the gender of the thing being
created. In Japanese the word for the latin language is different from the
latin script. So to disambiguate some strings a little bit of context information
may appear before the actual string to be translated:
<BLOCKQUOTE>
<PRE>msgid "File|_New"
msgstr "<FONT COLOR="Red">_Nouveau</FONT>"
</PRE>
</BLOCKQUOTE>
<P>
or
<BLOCKQUOTE>
<PRE>msgid "Anchor|_New"
msgstr "<FONT COLOR="Red">_Nouvelle</FONT>"
</PRE>
</BLOCKQUOTE>
<P>
The context will be any text before an "|". It should not be translated.
Indeed both it and the "|" should be completely omitted.
<P>
Finally we have the problem of <A NAME="plurals">plurals</A>. Suppose we
have a string
<BLOCKQUOTE>
<PRE>msgid "%d Group"
</PRE>
</BLOCKQUOTE>
<P>
We need to inflect the word "Group" depending on the number of groups we've
got -- and each language has different rules.
<P>
Remember, at the beginning of the file there was a line:
<BLOCKQUOTE>
<PRE>"Plural-Forms: nplurals=<FONT COLOR="Red">2</FONT>; plural=<FONT COLOR="Red">n>1</FONT>;\n"
</PRE>
</BLOCKQUOTE>
<P>
This says that this language has two plural forms, the singular form is used
when there are 0 or 1 entries (n<=1), and the plural form is used for
n>1 entries. That rule is correct for French. English looks like:
<BLOCKQUOTE>
<PRE>"Plural-Forms: nplurals=<FONT COLOR="Red">2</FONT>; plural=<FONT COLOR="Red">n!=1</FONT>;\n"
</PRE>
</BLOCKQUOTE>
<P>
A language like classical Greek, which has a dual form, might look like
<BLOCKQUOTE>
<PRE>"Plural-Forms: nplurals=<FONT COLOR="Red">3</FONT>; plural=<FONT COLOR="Red">n<=1?0:n==2?1:2</FONT>;\n"
</PRE>
</BLOCKQUOTE>
<P>
The expression is a c language expression. When there is a string that might
be plural it has a slightly different form in the po file
<BLOCKQUOTE>
<PRE>#: groups.c:1558
msgid "%d Group"
msgid_plural "%d Groups"
msgstr[0] "<FONT COLOR="Red">%d Groupe</FONT>"
msgstr[1] "<FONT COLOR="Red">%d Groupes</FONT>"
</PRE>
</BLOCKQUOTE>
<P>
Obviously, in a language with three forms there would be additional
<CODE>msgstr[n] </CODE>entries.
<H2>
<A NAME="Updating">Updating</A> an already existing "po" file
</H2>
<P>
After a few months, you will probably find that I've added some additional
strings to FontForge, and you may want to update your original po file.
<P>
Once again you <A HREF="uitranslationnotes.html#Obtaining">grab a current
"pot" file</A> and you type:
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>msgmerge <FONT COLOR="Red">fr</FONT>.po FontForge.pot ><FONT COLOR="Red">fr</FONT>-new.po
</PRE>
</BLOCKQUOTE>
<P>
This will update your po file to contain any new strings for you to translate.
It will also make guesses for these new strings. Some of these guesses are
correct, some are very strange, so you will want to examine the guessed strings
(they will be marked with the word "fuzzy" -- emacs has a mode that makes
checking these easy).
<H2>
<A NAME="Testing">Testing</A> a "po" file
</H2>
<P>
Once you have completed your po file you will want to test it.
<OL>
<LI>
If you have a copy of the fontforge source distribution you can test it by
<UL>
<LI>
copying your new file into the fontforge/po directory:
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>cp <FONT COLOR="Red">fr</FONT>.po fontforge-20060819/fontforge/po
</PRE>
</BLOCKQUOTE>
<LI>
Reconfiguring fontforge, and installing it
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>cd fontforge-20060819
<FONT COLOR="Gray">$ </FONT>./configure
<FONT COLOR="Gray">$ </FONT>make
<FONT COLOR="Gray">$ </FONT>su
<FONT COLOR="Gray"># </FONT>make install
</PRE>
</BLOCKQUOTE>
</UL>
<LI>
Or, if you want to do things manually:
<UL>
<LI>
First you need to compile it:
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>msgfmt -o <FONT COLOR="Red">fr</FONT>.mo <FONT COLOR="Red">fr</FONT>.po
</PRE>
</BLOCKQUOTE>
<P>
and create an "mo" file.
<LI>
This file you will want to rename and move to the appropriate directory.
If fontforge is installed in /usr/local/bin then you would say
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>mv <FONT COLOR="Red">fr</FONT>.mo /usr/local/share/locale/<FONT COLOR="Red">fr</FONT>/LC_MESSAGES/FontForge.mo
</PRE>
</BLOCKQUOTE>
</UL>
</OL>
<P>
Then make sure your locale is set properly (and that your operating system
has the support files it needs for that locale) and start fontforge. You
should see your translation
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>LANG=<FONT COLOR="Red">fr_FR.UTF-8</FONT>; export LANG
<FONT COLOR="Gray">$ </FONT>fontforge -new
</PRE>
</BLOCKQUOTE>
<P>
<IMG SRC="fontview.fr.png" WIDTH="423" HEIGHT="226">
<HR>
<H2>
Still <A NAME="More">more</A> strings to translate!
</H2>
<P>
FontForge has some strings that do not fit into the standard gettext mechanism.
These are strings for which fontforge wants to know all translations at all
times. For exampe the truetype 'name' table encourages designers to provide
a translation for the stylistic variant of the font into as many languages
as possible. So if you had a Bold font it would be nice if the 'name' table
contained: An English entry, "Bold"; A French entry, "Gras"; A German entry,
"Fett". To make this easier on the designer FontForge would like to have
all translations of "Bold" built into it at all times, all translations of
"Italic", "Condensed", and so forth.
<P>
<A HREF="fontstyles.html">There is a table of the stylistic names FontForge
recognizes on the Font Info page.</A>
<P>
There is a second list of names for which FontForge would like multiple
translations because these also appear in the 'name' table translated into
as many languages as possible. These are the names of the mac's Feature/Setting
strings, and they may be found on
<A HREF="http://developer.apple.com/fonts/Registry/index.html">Apple's Font
Feature registry</A>.
<P>
Finally I would like to make it as easy as possible to embed the
<A HREF="http://scripts.sil.org/OFL">OFL</A> into a font created by FontForge,
and I would like to encourage its translation (And that of its accompanying
FAQ) into as many languages as possible.
<P>
SIL regards translation as important but adds the following caveats (in their
<A HREF="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=OFL-FAQ_web">FAQ</A>):
<BLOCKQUOTE>
<B>5.5 How about translating the license and the FAQ into other languages?</B>
<P>
SIL certainly recognises the need for people who are not familiar with English
to be able to understand the OFL and this FAQ better in their own language.
Making the license very clear and readable is a key goal of the OFL.
<P>
If you are an experienced translator, you are very welcome to help translating
the OFL and its FAQ so that designers and users in your language community
can understand the license better. But only the original English version
of the license has legal value and has been approved by the community.
Translations do not count as legal substitutes and should only serve as a
way to explain the original license. SIL - as the author and steward of the
license for the community at large - does not approve any translation of
the OFL as legally valid because even small translations ambiguities could
be abused and create problems.
<P>
We give permission to publish unofficial translations into other languages
provided that they comply with the following guidelines:
<P>
- put the following disclaimer in both English and the target language stating
clearly that the translation is unofficial:
<BLOCKQUOTE>
"This is an unofficial translation of the SIL Open Font License into $language.
It was not published by SIL International, and does not legally state the
distribution terms for fonts that use the OFL. A release under the OFL is
only valid when using the original English text.
<P>
However, we recognize that this unofficial translation will help users and
designers not familiar with English to understand the SIL OFL better and
make it easier to use and release font families under this collaborative
font design model. We encourage designers who consider releasing their creation
under the OFL to read the FAQ in their own language if it is available.
<P>
Please go to http://scripts.sil.org/OFL for the official version of the license
and the accompanying FAQ."
</BLOCKQUOTE>
<P>
- keep your unofficial translation current and update it at our request if
needed, for example if there is any ambiguity which could lead to confusion.
<P>
If you start such a unofficial translation effort of the OFL and its accompanying
FAQ please let us know, thank you.
</BLOCKQUOTE>
<P>
<A HREF="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=OFL_web">The
text of the current version of the OFL</A>. If anyone is interested in
translation both the OFL and its FAQ
<A HREF="mailto:fontforge-devel@lists.sourceforge.net">please let me know</A>
(via mailing list) and I will provide Web space for both. I had intended
to include these translations in the font's 'name' table, but have been asked
not to because of the possible legal ramifications.
<P>
At the moment (Feb 2007) OFL version 1.1 has just been released. I have collected
the <A HREF="OFL-Unofficial.html">following unofficial translations</A>.
<P>
<HR>
<H2>
Changing the assignment of <A NAME="HotKeys">Hot Keys</A>
</H2>
<P>
FontForge has a <A HREF="HotKeys.html">default assignment of hot key </A>(menu
shortcuts, whatever term you wish to use). This assignment can be difficult
to use on non-English keyboards. Even users with English keyboards might
find reasons to disagree with it. So FontForge allows you to redefine the
hot keys. This is done using a gettext mechanism, but in a different pot
file from the normal set of translation strings (which means it uses a different
gettext "text domain").
<P>
The hot key pot file is called: <TT>FontForge-MenuShortCuts.pot</TT>
<P>
(This can also be obtained <A HREF="FontForge-MenuShortCuts.pot.bz2">from
the website</A>, or generated from the git repository)
<P>
On the Mac, FontForge allows for two different key bindings. X11 can be
configured to pass the command key on to FontForge, or X11 may use the command
key in its own menubar. If FontForge doesn't get the command key then it
will do normal processing using normal keybindings. Otherwise FontForge will
first look for a file called Mac-FontForge-MenuShortCuts.po if this is found
(and if it rebinds the string "Flag0x10+" (which should become "Cmd+" --
or whatever is appropriate in your language)) then it will be used. Otherwise
it falls back to normal processing.
<P>
This file consists of a sequence of entries that look like:
<BLOCKQUOTE>
<PRE>#: bitmapview.c:1720 charview.c:7833 charview.c:9079 fontview.c:6521
msgid "New|Ctl+N"
msgstr ""
#: bitmapview.c:1721 charview.c:7834 charview.c:9080 fontview.c:6525
msgid "Open|Ctl+O"
msgstr ""
#: bitmapview.c:1723 charview.c:7836 charview.c:9082 fontview.c:6527
msgid "Close|Ctl+Shft+Q"
msgstr ""
#: bitmapview.c:1729 charview.c:7842
msgid "Export...|No Shortcut"
msgstr ""
#: fontview.c:7798
msgid "Help|F1"
msgstr ""
</PRE>
</BLOCKQUOTE>
<P>
Each entry (msgid) is formatted as follows
<UL>
<LI>
First is the command name as it appears in the (English) menu.
<LI>
Then there is the special character "|" which separates the command name
from the hot key specification.
<LI>
Then a list of key modifiers separated by "+"
<LI>
And finally the key itself
</UL>
<P>
So in the first example above <CODE>New|Ctl+N</CODE> means that this is the
hot key for the New command, and that the default definition of that hot
key is Control N.
<P>
Modifier lists can be more complex <CODE>Close|Ctl+Shft+Q</CODE> means that
the hot key for the Close command is Control Shift Q.
<P>
Not all commands have hot keys in the default assignment, but since some
users might want to assign keys to them they still have entries. Thus
<CODE>Export...|No Shortcut</CODE> means that the Export command has no shortcut
(no hot key) in English.
<P>
It is also possible to use keys with no modifiers. Generally you will not
want to do that for a normal, alphabetic key, but for special keys, like
the function keys, it is perfectly acceptable. <CODE>Help|F1</CODE> means
that the Help command is bound to the first function key.
<HR>
<P>
So that's what the msgid field means. The above information describes the
default key bindings. You want to know how to change them. The format is
almost the same (the only exception is that you will not include the command
name nor the "|" separator), but you need to change the msgstr field.
<P>
Suppose that you wanted to remove the shortcut for the open command, and
add one to the Export command: You might create a po file which looks like:
<BLOCKQUOTE>
<PRE>#: #: bitmapview.c:1721 charview.c:7834 charview.c:9080 fontview.c:6525
msgid "Open|Ctl+O"
msgstr "No Shortcut"
#: bitmapview.c:1729 charview.c:7842
msgid "Export...|No Shortcut"
msgstr "Alt+Cntl+Shft+E"
</PRE>
</BLOCKQUOTE>
<P>
NOTE: <FONT COLOR="Red"><STRONG>Omitting a string will not remove the
shortcut</STRONG></FONT>. Instead FontForge will use the default shortcut.
If you want to remove a shortcut you must add an explicit assignment to
"<CODE>No Shortcut</CODE>".
<P>
FontForge recognizes the following standard modifiers: <CODE>Alt+, Ctl+,
Shft+, CapsLock+, Opt+</CODE> (the last corresponds to the Option key on
the mac keyboard, <CODE>Cmd+</CODE> for the mac Command key
<FONT COLOR="Red"><STRONG>Note: </STRONG></FONT>This can only be used by
an X program if the X11 application does not appropriate it -- this can be
configured in the X11 Preferences).
<P>
Some keyboards have additional modifier keys, X maps them to a flag bit in
the keyboard state mask of the XKeyEvent. If you want to use these modifiers
you need to know what that bit is. FontForge will also recognize:<BR>
<CODE>Flag0x01+, Flag0x02+, Flag0x04+, Flag0x08+,<BR>
Flag0x10+, Flag0x20+, Flag0x40+, Flag0x80+</CODE>
<P>
The hot key itself should be entered in UTF-8.
<HR>
<P>
There are a few other strings in this file.
<P>
When FF displays a shortcut in the menu it will use a similar syntax.<BR>
That may not be appropriate for non-English terminals. On a French system
it might be better to show the Shift modifier as <I>Majuscule</I>. At the
bottom of this file are several entries which are not used to set shortcuts
but are used in displaying the shortcuts in the menu, thus
<BLOCKQUOTE>
<PRE>#: ../gdraw/gmenu.c:120
msgid "Shft+"
msgstr "Maj+"
msgid "Flag0x80+"
msgstr "AltGr+"
</PRE>
</BLOCKQUOTE>
<P>
(These changes only affect what FontForge <EM>displays</EM> in the menu.
If you try to specify a keybinding as <CODE>msgstr "Ctl+Maj+E" </CODE>it
will <FONT COLOR="Red"><STRONG>NOT</STRONG></FONT> work)
<P>
Even though not obvious from this file, it is also possible to add names
for special keys. So you could add:
<BLOCKQUOTE>
<PRE>msgid "Escape"
msgstr "Échappe"
msgid "Delete"
msgstr "Efface"
</PRE>
</BLOCKQUOTE>
<P>
The English names accepted for special keys are those defined under XK_MISCELLANY
in keysymdef.h of the X11 header files -- without the initial XK_
<HR>
<P>
You can obtain a <CODE>FontForge-MenuShortCuts.pot </CODE>file in pretty
much the same way you <A HREF="uitranslationnotes.html#Obtaining">obtain
a <CODE>FontForge.pot</CODE> file</A> -- download the source and then type:
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>cd fontforge/fontforge
<FONT COLOR="Gray">$ </FONT>make -f Makefile.in FontForge-MenuShortCuts.pot
</PRE>
</BLOCKQUOTE>
<P>
Again you will want to <A HREF="uitranslationnotes.html#Modifying">rename
this file before working on it</A>:
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>mv FontForge-MenuShortCuts.pot fr-MenuShortCuts.po
</PRE>
</BLOCKQUOTE>
<P>
Then edit the file to insert your short cuts.
<P>
If you want to install your new short cuts:
<UL>
<LI>
First you need to compile it:
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>msgfmt -o <FONT COLOR="Red">fr-MenuShortCuts</FONT>.mo <FONT COLOR="Red">fr-MenuShortCuts</FONT>.po
</PRE>
</BLOCKQUOTE>
<P>
and create an "mo" file.
<LI>
This file you will want to rename and move to the appropriate directory.
If fontforge is installed in /usr/local/bin then you would say
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>mv <FONT COLOR="Red">fr-MenuShortCuts</FONT>.mo /usr/local/share/locale/<FONT COLOR="Red">fr</FONT>/LC_MESSAGES/FontForge-MenuShortCuts.mo
</PRE>
</BLOCKQUOTE>
<P>
The above example assumes you have FontForge installed in
<CODE>/usr/local</CODE>. If you installed it elsewhere (<CODE>/usr </CODE>for
instance) simply replace <CODE>/usr/local/share</CODE> with
<CODE>/usr/share</CODE>, or whatever is appropriate.
</UL>
<P>
Currently there are no examples of these files, and there is nothing in the
Makefile to install them.
<P>
Creating a Mac file is similar. There is one example of this in the git
repository under <CODE>po/mackeys/en.po</CODE>. It should be the same as
the default key bindings except that the Control key has been replaced everywhere
with the Command key. You can install it
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>mv <FONT COLOR="Red">en</FONT>.mo /usr/local/share/locale/<FONT COLOR="Red">en</FONT>/LC_MESSAGES/Mac-FontForge-MenuShortCuts.mo
</PRE>
</BLOCKQUOTE>
<P>
</DIV>
</BODY></HTML>
|