aboutsummaryrefslogtreecommitdiff
path: root/en_US.ISO8859-1/books/fdp-primer/po-translations/chapter.xml
blob: e89c3bde73e30dd0025ade9355881fdab3c3760d (plain) (blame)
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
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
    The FreeBSD Documentation Project
-->
<chapter xmlns="http://docbook.org/ns/docbook"
  xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
  xml:id="po-translations">

  <title><acronym>PO</acronym> Translations</title>

  <sect1 xml:id="po-translations-introduction">
    <title>Introduction</title>

    <para>The <link
	xlink:href="http://www.gnu.org/software/gettext/"><acronym>GNU</acronym>
	<application>gettext</application></link> system offers
      translators an easy way to create and maintain translations of
      documents.  Translatable strings are extracted from the original
      document into a <acronym>PO</acronym> (Portable Object) file.
      Translated versions of the strings are entered with a separate
      editor.  The strings can be used directly or built into a
      complete translated version of the original document.</para>
  </sect1>

  <sect1 xml:id="po-translations-quick-start">
    <title>Quick Start</title>

    <para>The procedure shown in
      <xref linkend="overview-quick-start"/> is assumed to have
      already been performed. The <literal>TRANSLATOR</literal>
      option is required and already enabled by default in the
      <package role="port">textproc/docproj</package> port.</para>

    <para>This example shows the creation of a Spanish translation of
      the short <link xlink:href="&url.articles.leap-seconds.en;">Leap
	Seconds</link> article.</para>

    <procedure xml:id="po-translations-quick-start-install-po-editor">
      <title>Install a <acronym>PO</acronym> Editor</title>

      <step>
	<para>A <acronym>PO</acronym> editor is needed to edit
	  translation files.  This example uses
	  <package role="ports">editors/poedit</package>.</para>

	<screen>&prompt.root; <userinput>cd /usr/ports/editors/poedit</userinput>
&prompt.root; <userinput>make install clean</userinput></screen>
      </step>
    </procedure>

    <procedure xml:id="po-translations-quick-start-initial-setup">
      <title>Initial Setup</title>

      <para>When a new translation is first created, the directory
	structure and <filename>Makefile</filename> must be created or
	copied from the English original:</para>

      <step>
	<para>Create a directory for the new translation.  The
	  English article source is in
	  <filename>~/doc/en_US.ISO8859-1/articles/leap-seconds/</filename>.
	  The Spanish translation will go in
	  <filename>~/doc/es_ES.ISO8859-1/articles/leap-seconds/</filename>.
	  The path is the same except for the name of the language
	  directory.</para>

	<screen>&prompt.user; <userinput>svn mkdir --parents ~/doc/es_ES.ISO8859-1/articles/leap-seconds/</userinput></screen>
      </step>

      <step>
	<para>Copy the <filename>Makefile</filename> from the original
	  document into the translation directory:</para>

	<screen>&prompt.user; <userinput>svn cp ~/doc/en_US.ISO8859-1/articles/leap-seconds/Makefile \
    ~/doc/es_ES.ISO8859-1/articles/leap-seconds/</userinput></screen>
      </step>
    </procedure>

    <procedure xml:id="po-translations-quick-start-translation">
      <title>Translation</title>

      <para>Translating a document consists of two steps: extracting
	translatable strings from the original document, and entering
	translations for those strings.  These steps are repeated
	until the translator feels that enough of the document has
	been translated to produce a usable translated
	document.</para>

      <step>
	<para>Extract the translatable strings from the original
	  English version into a <acronym>PO</acronym> file:</para>

	<screen>&prompt.user; <userinput>cd ~/doc/es_ES.ISO8859-1/articles/leap-seconds/</userinput>
&prompt.user; <userinput>make po</userinput></screen>
      </step>

      <step>
	<para>Use a <acronym>PO</acronym> editor to enter translations
	  in the <acronym>PO</acronym> file.  There are several
	  different editors available.  <filename>poedit</filename>
	  from <package role="port">editors/poedit</package> is shown
	  here.</para>

	<para>The <acronym>PO</acronym> file name is the
	  two-character language code followed by an underline and a
	  two-character region code.  For Spanish, the file name is
	  <filename>es_ES.po</filename>.</para>

	<screen>&prompt.user; <userinput>poedit es_ES.po</userinput></screen>
      </step>
    </procedure>

    <procedure
      xml:id="po-translations-quick-generating-a-translated-document">
      <title>Generating a Translated Document</title>

      <step>
	<para>Generate the translated document:</para>

	<screen>&prompt.user; <userinput>cd ~/doc/es_ES.ISO8859-1/articles/leap-seconds/</userinput>
&prompt.user; <userinput>make tran</userinput></screen>

	<para>The name of the generated document matches the name
	  of the English original, usually
	  <filename>article.xml</filename> for articles or
	  <filename>book.xml</filename> for books.</para>
      </step>

      <step>
	<para>Check the generated file by rendering it to
	  <acronym>HTML</acronym> and viewing it with a
	  web browser:</para>

	<screen>&prompt.user; <userinput>make FORMATS=html</userinput>
&prompt.user; <userinput>firefox article.html</userinput></screen>
      </step>
    </procedure>
  </sect1>

  <sect1 xml:id="po-translations-creating">
    <title>Creating New Translations</title>

    <para>The first step to creating a new translated document is
      locating or creating a directory to hold it.  &os; puts
      translated documents in a subdirectory named for their
      language and region in the format
      <filename><replaceable>lang</replaceable>_<replaceable>REGION</replaceable></filename>.
      <replaceable>lang</replaceable> is a two-character lowercase
      code.  It is followed by an underscore character and then the
      two-character uppercase <replaceable>REGION</replaceable>
      code.</para>

    <table xml:id="po-translations-language-names" frame="none">
      <title>Language Names</title>

      <tgroup cols="5">
	<thead>
	  <row>
	    <entry>Language</entry>
	    <entry>Region</entry>
	    <entry>Translated Directory Name</entry>
	    <entry><acronym>PO</acronym> File Name</entry>
	    <entry>Character Set</entry>
	  </row>
	</thead>

	<tbody>
	  <row>
	    <entry>English</entry>
	    <entry>United States</entry>
	    <entry><filename>en_US.ISO8859-1</filename></entry>
	    <entry><filename>en_US.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-1</entry>
	  </row>

	  <row>
	    <entry>Bengali</entry>
	    <entry>Bangladesh</entry>
	    <entry><filename>bn_BD.UTF-8</filename></entry>
	    <entry><filename>bn_BD.po</filename></entry>
	    <entry><acronym>UTF</acronym>-8</entry>
	  </row>

	  <row>
	    <entry>Danish</entry>
	    <entry>Denmark</entry>
	    <entry><filename>da_DK.ISO8859-1</filename></entry>
	    <entry><filename>da_DK.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-1</entry>
	  </row>

	  <row>
	    <entry>German</entry>
	    <entry>Germany</entry>
	    <entry><filename>de_DE.ISO8859-1</filename></entry>
	    <entry><filename>de_DE.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-1</entry>
	  </row>

	  <row>
	    <entry>Greek</entry>
	    <entry>Greece</entry>
	    <entry><filename>el_GR.ISO8859-7</filename></entry>
	    <entry><filename>el_GR.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-7</entry>
	  </row>

	  <row>
	    <entry>Spanish</entry>
	    <entry>Spain</entry>
	    <entry><filename>es_ES.ISO8859-1</filename></entry>
	    <entry><filename>es_ES.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-1</entry>
	  </row>

	  <row>
	    <entry>French</entry>
	    <entry>France</entry>
	    <entry><filename>fr_FR.ISO8859-1</filename></entry>
	    <entry><filename>fr_FR.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-1</entry>
	  </row>

	  <row>
	    <entry>Hungarian</entry>
	    <entry>Hungary</entry>
	    <entry><filename>hu_HU.ISO8859-2</filename></entry>
	    <entry><filename>hu_HU.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-2</entry>
	  </row>

	  <row>
	    <entry>Italian</entry>
	    <entry>Italy</entry>
	    <entry><filename>it_IT.ISO8859-15</filename></entry>
	    <entry><filename>it_IT.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-15</entry>
	  </row>

	  <row>
	    <entry>Japanese</entry>
	    <entry>Japan</entry>
	    <entry><filename>ja_JP.eucJP</filename></entry>
	    <entry><filename>ja_JP.po</filename></entry>
	    <entry><acronym>EUC</acronym> JP</entry>
	  </row>

	  <row>
	    <entry>Korean</entry>
	    <entry>Korea</entry>
	    <entry><filename>ko_KR.UTF-8</filename></entry>
	    <entry><filename>ko_KR.po</filename></entry>
	    <entry><acronym>UTF</acronym>-8</entry>
	  </row>

	  <row>
	    <entry>Mongolian</entry>
	    <entry>Mongolia</entry>
	    <entry><filename>mn_MN.UTF-8</filename></entry>
	    <entry><filename>mn_MN.po</filename></entry>
	    <entry><acronym>UTF</acronym>-8</entry>
	  </row>

	  <row>
	    <entry>Dutch</entry>
	    <entry>Netherlands</entry>
	    <entry><filename>nl_NL.ISO8859-1</filename></entry>
	    <entry><filename>nl_NL.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-1</entry>
	  </row>

	  <row>
	    <entry>Polish</entry>
	    <entry>Poland</entry>
	    <entry><filename>pl_PL.ISO8859-2</filename></entry>
	    <entry><filename>pl_PL.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-2</entry>
	  </row>

	  <row>
	    <entry>Portuguese</entry>
	    <entry>Brazil</entry>
	    <entry><filename>pt_BR.ISO8859-1</filename></entry>
	    <entry><filename>pt_BR.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-1</entry>
	  </row>

	  <row>
	    <entry>Russian</entry>
	    <entry>Russia</entry>
	    <entry><filename>ru_RU.KOI8-R</filename></entry>
	    <entry><filename>ru_RU.po</filename></entry>
	    <entry><acronym>KOI</acronym>8-R</entry>
	  </row>

	  <row>
	    <entry>Turkish</entry>
	    <entry>Turkey</entry>
	    <entry><filename>tr_TR.ISO8859-9</filename></entry>
	    <entry><filename>tr_TR.po</filename></entry>
	    <entry><acronym>ISO</acronym> 8859-9</entry>
	  </row>

	  <row>
	    <entry>Chinese</entry>
	    <entry>China</entry>
	    <entry><filename>zh_CN.UTF-8</filename></entry>
	    <entry><filename>zh_CN.po</filename></entry>
	    <entry><acronym>UTF</acronym>-8</entry>
	  </row>

	  <row>
	    <entry>Chinese</entry>
	    <entry>Taiwan</entry>
	    <entry><filename>zh_TW.UTF-8</filename></entry>
	    <entry><filename>zh_TW.po</filename></entry>
	    <entry><acronym>UTF</acronym>-8</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>

    <para>The translations are in subdirectories of the main
      documentation directory, here assumed to be
      <filename>~/doc/</filename> as shown in
      <xref linkend="overview-quick-start"/>.  For example, German
      translations are located in
      <filename>~/doc/de_DE.ISO8859-1/</filename>, and French
      translations are in
      <filename>~/doc/fr_FR.ISO8859-1/</filename>.</para>

    <para>Each language directory contains separate subdirectories
      named for the type of documents, usually
      <filename>articles/</filename> and
      <filename>books/</filename>.</para>

    <para>Combining these directory names gives the complete path to
      an article or book.  For example, the French translation of the
      NanoBSD article is in
      <filename>~/doc/fr_FR.ISO8859-1/articles/nanobsd/</filename>,
      and the Mongolian translation of the Handbook is in
      <filename>~/doc/mn_MN.UTF-8/books/handbook/</filename>.</para>

    <para>A new language directory must be created when translating
      a document to a new language.  If the language directory already
      exists, only a subdirectory in the
      <filename>articles/</filename> or <filename>books/</filename>
      directory is needed.</para>

    <para>&os; documentation builds are controlled by a
      <filename>Makefile</filename> in the same directory.  With
      simple articles, the <filename>Makefile</filename> can often
      just be copied verbatim from the original English directory.
      The translation process combines multiple separate
      <filename>book.xml</filename> and
      <filename>chapter.xml</filename> files in books into a single
      file, so the <filename>Makefile</filename> for book translations
      must be copied and modified.</para>

    <example xml:id="po-translations-creating-example">
      <title>Creating a Spanish Translation of the Porter's
	Handbook</title>

      <para>Create a new Spanish translation of the
	<link xlink:href="&url.books.porters-handbook.en;">Porter's
	  Handbook</link>.  The original is a book in
	<filename>~/doc/en_US.ISO8859-1/books/porters-handbook/</filename>.</para>

      <procedure>
	<step>
	  <para>The Spanish language books directory
	    <filename>~/doc/es_ES.ISO8859-1/books/</filename> already
	    exists, so only a new subdirectory for the Porter's
	    Handbook is needed:</para>
	  <screen>&prompt.user; <userinput>cd ~/doc/es_ES.ISO8859-1/books/</userinput>
&prompt.user; <userinput>svn mkdir porters-handbook</userinput>
A         porters-handbook</screen>
	</step>

	<step>
	  <para>Copy the <filename>Makefile</filename> from the
	    original book:</para>

	  <screen>&prompt.user; <userinput>cd ~/doc/es_ES.ISO8859-1/books/porters-handbook</userinput>
&prompt.user; <userinput>svn cp ~/doc/en_US.ISO8859-1/books/porters-handbook/Makefile .</userinput>
A         Makefile</screen>

	  <para>Modify the contents of the
	    <filename>Makefile</filename> to only expect a single
	    <filename>book.xml</filename>:</para>

	  <programlisting>#
# &dollar;FreeBSD&dollar;
#
# Build the FreeBSD Porter's Handbook.
#

MAINTAINER=doc@FreeBSD.org

DOC?= book

FORMATS?= html-split

INSTALL_COMPRESSED?= gz
INSTALL_ONLY_COMPRESSED?=

# XML content
SRCS=  book.xml

# Images from the cross-document image library
IMAGES_LIB+=    callouts/1.png
IMAGES_LIB+=    callouts/2.png
IMAGES_LIB+=    callouts/3.png
IMAGES_LIB+=    callouts/4.png
IMAGES_LIB+=    callouts/5.png
IMAGES_LIB+=    callouts/6.png
IMAGES_LIB+=    callouts/7.png
IMAGES_LIB+=    callouts/8.png
IMAGES_LIB+=    callouts/9.png
IMAGES_LIB+=    callouts/10.png
IMAGES_LIB+=    callouts/11.png
IMAGES_LIB+=    callouts/12.png
IMAGES_LIB+=    callouts/13.png
IMAGES_LIB+=    callouts/14.png
IMAGES_LIB+=    callouts/15.png
IMAGES_LIB+=    callouts/16.png
IMAGES_LIB+=    callouts/17.png
IMAGES_LIB+=    callouts/18.png
IMAGES_LIB+=    callouts/19.png
IMAGES_LIB+=    callouts/20.png
IMAGES_LIB+=    callouts/21.png

URL_RELPREFIX?= ../../../..
DOC_PREFIX?= ${.CURDIR}/../../..

.include "${DOC_PREFIX}/share/mk/doc.project.mk"</programlisting>

	  <para>Now the document structure is ready for the translator
	    to begin translating with
	    <command>make po</command>.</para>
	</step>
      </procedure>
    </example>

    <example xml:id="po-translations-creating-example-french">
      <title>Creating a French Translation of the
	<acronym>PGP</acronym> Keys Article</title>

      <para>Create a new French translation of the
	<link
	  xlink:href="&url.articles.pgpkeys;"><acronym>PGP</acronym>
	  Keys article</link>.  The original is an article in
	<filename>~/doc/en_US.ISO8859-1/articles/pgpkeys/</filename>.</para>

      <procedure>
	<step>
	  <para>The French language article directory
	    <filename>~/doc/fr_FR.ISO8859-1/articles/</filename>
	    already exists, so only a new subdirectory for the
	    <acronym>PGP</acronym> Keys article is needed:</para>
	  <screen>&prompt.user; <userinput>cd ~/doc/fr_FR.ISO8859-1/articles/</userinput>
&prompt.user; <userinput>svn mkdir pgpkeys</userinput>
A         pgpkeys</screen>
	</step>

	<step>
	  <para>Copy the <filename>Makefile</filename> from the
	    original article:</para>

	  <screen>&prompt.user; <userinput>cd ~/doc/fr_FR.ISO8859-1/articles/pgpkeys</userinput>
&prompt.user; <userinput>svn cp ~/doc/en_US.ISO8859-1/articles/pgpkeys/Makefile .</userinput>
A         Makefile</screen>

	  <para>Check the contents of the
	    <filename>Makefile</filename>.  Because this is a simple
	    article, in this case the <filename>Makefile</filename>
	    can be used unchanged.  The <literal>$&os;...$</literal>
	    version string on the second line will be replaced by the
	    version control system when this file is committed.</para>

	  <programlisting>#
# &dollar;FreeBSD&dollar;
#
# Article: PGP Keys

DOC?= article

FORMATS?= html
WITH_ARTICLE_TOC?= YES

INSTALL_COMPRESSED?= gz
INSTALL_ONLY_COMPRESSED?=

SRCS=   article.xml

# To build with just key fingerprints, set FINGERPRINTS_ONLY.

URL_RELPREFIX?= ../../../..
DOC_PREFIX?=    ${.CURDIR}/../../..

.include "${DOC_PREFIX}/share/mk/doc.project.mk"</programlisting>

	  <para>With the document structure complete, the
	    <acronym>PO</acronym> file can be created with
	    <command>make po</command>.</para>
	</step>
      </procedure>
    </example>
  </sect1>

  <sect1 xml:id="po-translations-translating">
    <title>Translating</title>

    <para>The <application>gettext</application> system greatly
      reduces the number of things that must be tracked by a
      translator.  Strings to be translated are extracted from the
      original document into a <acronym>PO</acronym> file.  Then a
      <acronym>PO</acronym> editor is used to enter the translated
      versions of each string.</para>

    <para>The &os; <acronym>PO</acronym> translation system does not
      overwrite <acronym>PO</acronym> files, so the extraction step
      can be run at any time to update the <acronym>PO</acronym>
      file.</para>

    <para>A <acronym>PO</acronym> editor is used to edit the file.
      <package role="port">editors/poedit</package> is shown in
      these examples because it is simple and has minimal
      requirements.  Other <acronym>PO</acronym> editors offer
      features to make the job of translating easier.  The Ports
      Collection offers several of these editors, including
      <package role="port">devel/gtranslator</package>.</para>

    <para>It is important to preserve the <acronym>PO</acronym> file.
      It contains all of the work that translators have done.</para>

    <example xml:id="po-translations-translating-example">
      <title>Translating the Porter's Handbook to Spanish</title>

      <para>Enter Spanish translations of the contents of the Porter's
	Handbook.</para>

      <procedure>
	<step>
	  <para>Change to the Spanish Porter's Handbook directory and
	    update the <acronym>PO</acronym> file.  The generated
	    <acronym>PO</acronym> file is called
	    <filename>es_ES.po</filename> as shown in
	    <xref linkend="po-translations-language-names"/>.</para>

	  <screen>&prompt.user; <userinput>cd ~/doc/es_ES.ISO8859-1/books/porters-handbook</userinput>
&prompt.user; <userinput>make po</userinput></screen>
	</step>

	<step>
	  <para>Enter translations using a <acronym>PO</acronym>
	    editor:</para>

	  <screen>&prompt.user; <userinput>poedit es_ES.po</userinput></screen>
	</step>
      </procedure>
    </example>
  </sect1>

  <sect1 xml:id="po-translations-tips">
    <title>Tips for Translators</title>

    <sect2 xml:id="po-translations-tips-xmltags">
      <title>Preserving <acronym>XML</acronym> Tags</title>

      <para>Preserve <acronym>XML</acronym> tags that are shown in
	the English original.</para>

      <example>
	<title>Preserving <acronym>XML</acronym> Tags</title>

	<para>English original:</para>

	<programlisting>If <tag class="starttag">acronym</tag>NTP<tag class="endtag">acronym</tag> is not being used</programlisting>

	<para>Spanish translation:</para>

	<programlisting>Si <tag class="starttag">acronym</tag>NTP<tag class="endtag">acronym</tag> no se utiliza</programlisting>
      </example>
    </sect2>

    <sect2 xml:id="po-translations-tips-spaces">
      <title>Preserving Spaces</title>

      <para>Preserve existing spaces at the beginning and end of
	strings to be translated.  The translated version must have
	these spaces also.</para>
    </sect2>

    <sect2 xml:id="po-translations-tips-verbatim">
      <title>Verbatim Tags</title>

      <para>The contents of some tags should be copied verbatim, not
	translated:</para>

      <itemizedlist xml:id="po-translations-tips-verbatim-list">
	<listitem>
	  <para><tag class="starttag">citerefentry</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">command</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">filename</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">literal</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">manvolnum</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">orgname</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">package</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">programlisting</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">prompt</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">refentrytitle</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">screen</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">userinput</tag></para>
	</listitem>

	<listitem>
	  <para><tag class="starttag">varname</tag></para>
	</listitem>
      </itemizedlist>
    </sect2>

    <sect2 xml:id="po-translations-literal-dollar">
      <title><literal>&dollar;FreeBSD&dollar;</literal>
	Strings</title>

      <para>The &dollar;FreeBSD&dollar; version strings used in
	files require special handling.  In examples like
	<xref linkend="po-translations-creating-example"/>, these
	strings are not meant to be expanded.  The English documents
	use <literal>&amp;dollar;</literal> entities to avoid
	including actual literal dollar signs in the file:</para>

      <programlisting>&amp;dollar;FreeBSD&amp;dollar;</programlisting>

      <para>The <literal>&amp;dollar;</literal> entities are not seen
	as dollar signs by the version control system and so the
	string is not expanded into a version string.</para>

      <para>When a <acronym>PO</acronym> file is created, the
	<literal>&amp;dollar;</literal> entities used in examples are
	replaced with actual dollar signs.  The resulting literal
	<literal>&dollar;FreeBSD&dollar;</literal> string will be
	wrongly expanded by the version control system when the file
	is committed.</para>

      <para>The same technique as used in the English documents can be
	used in the translation.  The <literal>&amp;dollar;</literal>
	is used to replace the dollar sign in the translation entered
	into the <acronym>PO</acronym> editor:</para>

      <programlisting>&amp;dollar;FreeBSD&amp;dollar;</programlisting>
    </sect2>

    <!--
    <sect2 xml:id="po-translations-tips-makefile">
      <title>Modifying the <filename>Makefile</filename></title>

      <para>What needs to be changed in the
	<filename>Makefile</filename>?</para>
    </sect2>

    <sect2 xml:id="po-translations-tips-locale">
      <title>Setting Locales for Editing</title>

      <para>Locale settings so the <acronym>PO</acronym> editor works
	correctly?</para>
    </sect2>

    <sect2 xml:id="po-translations-tips-poeditors">
      <title>Settings for Specific <acronym>PO</acronym>
	Editors</title>

      <para>Per bcr: turn off "intelligent quotes" in
	Mac poedit.</para>
    </sect2>

    <sect2 xml:id="po-translations-tips-tm">
      <title>Using Translation Memory</title>

      <para>Using translation memory.  Saving, updating, sharing
	with other members of a translation team.</para>
    </sect2>

    <sect2 xml:id="po-translations-tips-submitting">
      <title>Submitting Translations</title>

      <para>Submitting translations as diffs, committing
	<acronym>PO</acronym> files.</para>
    </sect2>
    -->
  </sect1>

  <sect1 xml:id="po-translations-building">
    <title>Building a Translated Document</title>

    <para>A translated version of the original document can be created
      at any time.  Any untranslated portions of the original will be
      included in English in the resulting document.  Most
      <acronym>PO</acronym> editors have an indicator that shows how
      much of the translation has been completed.  This makes it easy
      for the translator to see when enough strings have been
      translated to make building the final document
      worthwhile.</para>

    <example xml:id="po-translations-building-example">
      <title>Building the Spanish Porter's Handbook</title>

      <para>Build and preview the Spanish version of the Porter's
	Handbook that was created in an earlier example.</para>

      <procedure>
	<step>
	  <para>Build the translated document.  Because the original
	    is a book, the generated document is
	    <filename>book.xml</filename>.</para>

	  <screen>&prompt.user; <userinput>cd ~/doc/es_ES.ISO8859-1/books/porters-handbook</userinput>
&prompt.user; <userinput>make tran</userinput></screen>
	</step>

	<step>
	  <para>Render the translated <filename>book.xml</filename> to
	    <acronym>HTML</acronym> and view it with
	    <application>Firefox</application>.  This is the
	    same procedure used with the English version of the
	    documents, and other <varname>FORMATS</varname> can
	    be used here in the same way.  See <xref
	      linkend="doc-build-rendering-common-formats"/>.</para>

	  <screen>&prompt.user; <userinput>make FORMATS=html</userinput>
&prompt.user; <userinput>firefox book.html</userinput></screen>
	</step>
      </procedure>
    </example>
  </sect1>

  <sect1 xml:id="po-translations-submitting">
    <title>Submitting the New Translation</title>

    <para>Prepare the new translation files for submission.  This
      includes adding the files to the version control system, setting
      additional properties on them, then creating a diff for
      submission.</para>

    <para>The diff files created by these examples can be attached to
      a <link
	xlink:href="https://bugs.freebsd.org/bugzilla/enter_bug.cgi?product=Documentation">documentation
	bug report</link> or <link
	xlink:href="https://reviews.freebsd.org/">code
	review</link>.</para>

    <example xml:id="po-translations-submitting-spanish">
      <title>Spanish Translation of the NanoBSD Article</title>

      <procedure>
	<step>
	  <para>Add a &os; version string comment as the first
	    line of the <acronym>PO</acronym> file:</para>

	  <programlisting>#&dollar;FreeBSD&dollar;</programlisting>
	</step>

	<step>
	  <para>Add the <filename>Makefile</filename>, the
	    <acronym>PO</acronym> file, and the generated
	    <acronym>XML</acronym> translation to
	    version control:</para>

	  <screen>&prompt.user; <userinput>cd ~/doc/es_ES.ISO8859-1/articles/nanobsd/</userinput>
&prompt.user; <userinput>ls</userinput>
Makefile	article.xml	es_ES.po
&prompt.user; <userinput>svn add Makefile article.xml es_ES.po</userinput>
A         Makefile
A         article.xml
A         es_ES.po</screen>
	</step>

	<step>
	  <para>Set the
	    <application>Subversion</application>
	    <literal>svn:keywords</literal> properties on these files
	    to <literal>FreeBSD=%H</literal> so
	    <literal>&dollar;FreeBSD&dollar;</literal> strings are
	    expanded into the path, revision, date, and author when
	    committed:</para>

	  <screen>&prompt.user; <userinput>svn propset svn:keywords FreeBSD=%H Makefile article.xml es_ES.po</userinput>
property 'svn:keywords' set on 'Makefile'
property 'svn:keywords' set on 'article.xml'
property 'svn:keywords' set on 'es_ES.po'</screen>
	</step>

	<step>
	  <para>Set the <acronym>MIME</acronym> types of the files.
	    These are <literal>text/xml</literal> for books and
	    articles, and
	    <literal>text/x-gettext-translation</literal> for the
	    <acronym>PO</acronym> file.</para>

	  <screen>&prompt.user; <userinput>svn propset svn:mime-type text/x-gettext-translation es_ES.po</userinput>
property 'svn:mime-type' set on 'es_ES.po'
&prompt.user; <userinput>svn propset svn:mime-type text/xml article.xml</userinput>
property 'svn:mime-type' set on 'article.xml'</screen>
	</step>

	<step>
	  <para>Create a diff of the new files from the
	    <filename>~/doc/</filename> base directory so the full
	    path is shown with the filenames.  This helps committers
	    identify the target language directory.</para>

	  <screen>&prompt.user; <userinput>cd ~/doc</userinput>
<userinput>svn diff es_ES.ISO8859-1/articles/nanobsd/ > /tmp/es_nanobsd.diff</userinput></screen>
	</step>
      </procedure>
    </example>

    <example xml:id="po-translations-submitting-korean-utf8">
      <title>Korean <acronym>UTF-8</acronym> Translation of the
	Explaining-BSD Article</title>

      <procedure>
	<step>
	  <para>Add a &os; version string comment as the first
	    line of the <acronym>PO</acronym> file:</para>

	  <programlisting>#&dollar;FreeBSD&dollar;</programlisting>
	</step>

	<step>
	  <para>Add the <filename>Makefile</filename>, the
	    <acronym>PO</acronym> file, and the generated
	    <acronym>XML</acronym> translation to
	    version control:</para>

	  <screen>&prompt.user; <userinput>cd ~/doc/ko_KR.UTF-8/articles/explaining-bsd/</userinput>
&prompt.user; <userinput>ls</userinput>
Makefile	article.xml	ko_KR.po
&prompt.user; <userinput>svn add Makefile article.xml ko_KR.po</userinput>
A         Makefile
A         article.xml
A         ko_KR.po</screen>
	</step>

	<step>
	  <para>Set the <application>Subversion</application>
	    <literal>svn:keywords</literal> properties on these files
	    to <literal>FreeBSD=%H</literal> so
	    <literal>&dollar;FreeBSD&dollar;</literal> strings are
	    expanded into the path, revision, date, and author when
	    committed:</para>

	  <screen>&prompt.user; <userinput>svn propset svn:keywords FreeBSD=%H Makefile article.xml ko_KR.po</userinput>
property 'svn:keywords' set on 'Makefile'
property 'svn:keywords' set on 'article.xml'
property 'svn:keywords' set on 'ko_KR.po'</screen>
	</step>

	<step>
	  <para>Set the <acronym>MIME</acronym> types of the files.
	    Because these files use the <acronym>UTF-8</acronym>
	    character set, that is also specified.  To prevent the
	    version control system from mistaking these files for
	    binary data, the <literal>fbsd:notbinary</literal>
	    property is also set:</para>

	  <screen>&prompt.user; <userinput>svn propset svn:mime-type 'text/x-gettext-translation; charset=UTF-8' ko_KR.po</userinput>
property 'svn:mime-type' set on 'ko_KR.po'
&prompt.user; <userinput>svn propset fbsd:notbinary yes ko_KR.po</userinput>
property 'fbsd:notbinary' set on 'ko_KR.po'
&prompt.user; <userinput>svn propset svn:mime-type 'text/xml; charset=UTF-8' article.xml</userinput>
property 'svn:mime-type' set on 'article.xml'
&prompt.user; <userinput>svn propset fbsd:notbinary yes article.xml</userinput>
property 'fbsd:notbinary' set on 'article.xml'</screen>
	</step>

	<step>
	  <para>Create a diff of these new files from the
	    <filename>~/doc/</filename> base directory:</para>

	  <screen>&prompt.user; <userinput>cd ~/doc</userinput>
<userinput>svn diff ko_KR.UTF-8/articles/explaining-bsd > /tmp/ko-explaining.diff</userinput></screen>
	</step>
      </procedure>
    </example>
  </sect1>
</chapter>