Home | History | Annotate | Download | only in po-sun
      1 # CDDL HEADER START
      2 #
      3 # The contents of this file are subject to the terms of the
      4 # Common Development and Distribution License, Version 1.0 only
      5 # (the "License").  You may not use this file except in compliance
      6 # with the License.
      7 #
      8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9 # or http://www.opensolaris.org/os/licensing.
     10 # See the License for the specific language governing permissions
     11 # and limitations under the License.
     12 #
     13 # When distributing Covered Code, include this CDDL HEADER in each
     14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15 # If applicable, add the following below this CDDL HEADER, with the
     16 # fields enclosed by brackets "[]" replaced with your own identifying
     17 # information: Portions Copyright [yyyy] [name of copyright owner]
     18 #
     19 # CDDL HEADER END
     20 #
     21 #
     22 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     23 # Use is subject to license terms.
     24 #
     25 
     26 
     27 What is the "SUN_BRANDING" tag
     28 ==============================
     29 
     30         The purpose is to extract Sun specific messages on GUI.
     31         CLI warning messages don't have to be translated but we need
     32         translations with visible GUI.
     33         I'ld like to extract the Sun specific message strings when adding 
     34         new strings and/or changing community strings for community packages.
     35 
     36 
     37 Supported file types
     38 ====================
     39 
     40         .c, .h,
     41         .py,
     42         .desktop.in, .directory.in,
     43         .sh.in,
     44         .server.in,
     45         .kbd.in,
     46         .xml[.in],
     47         .shcemas.in,
     48         .glade [1]
     49 
     50 
     51 Comment format per File type
     52 ============================
     53 
     54         - .c, .h
     55 
     56           /* SUN_BRANDING
     57              This is a comment line. */
     58           _("C string");
     59 
     60           /* SUN_BRANDING
     61              This is a comment line. */
     62           function (_("C string"), /* SUN_BRANDING */ _("another string"));
     63 
     64           /* SUN_BRANDING
     65              This is a comment line. */  [2]
     66           _("This is a "
     67             "multiple lines.");
     68 
     69           /* SUN_BRANDING
     70              This is a comment line. */
     71           ngettext ("snapshot", "snapshots", i);
     72 
     73 
     74         - .py
     75 
     76           # SUN_BRANDING
     77           print _("Python string")
     78 
     79           # SUN_BRANDING                 [2]
     80           a = N_("This is a "
     81                  "multiple lines.")
     82 
     83 
     84         - .desktop.in, .directory.in
     85 
     86           # SUN_BRANDING
     87           _Name=C string
     88           # SUN_BRANDING
     89           _Comment=C string
     90 
     91 
     92         - .sh.in [3]
     93 
     94           #!/bin/bash
     95           # SUN_BRANDING
     96           printf $"C string"
     97 
     98 
     99         - .server.in
    100 
    101           <!-- SUN_BRANDING
    102                This is a comment line. -->
    103           <oaf_attribute name="name" type="string" _value="C string"/>
    104 
    105 
    106         - .kbd.in
    107 
    108           <!-- SUN_BRANDING
    109                This is a comment line. -->
    110           <_GOK:label>C string</_GOK:label>
    111 
    112 
    113         - .xml[.in]
    114 
    115           <!-- SUN_BRANDING
    116                This is a comment line. -->
    117           <foo _name="C string">
    118 
    119 
    120         - .shcemas.in
    121 
    122           <locale name="C">
    123             <default><!-- SUN_BRANDING
    124                           This is a comment line. -->C string</default>
    125           </locale>
    126 
    127 
    128         - .glade
    129 
    130           <property name="title" translatable="yes" comments="SUN_BRANDING">C string</property>
    131 
    132 
    133 FIXME: 
    134 1. .theme and .icon files are not defined the comment "^#".
    135 http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
    136 2. Comments in .keys.in are not extracted by intltool-update.
    137 3. Need tests to work fine with comments in .cave and .soundlist files.
    138 
    139 Requirement: intltool 0.35.5 or later
    140 
    141 [1] Also works .in.in. files. e.g. desktop.in.in
    142 [2] Please do not use '+' to unite multiple lines in Python/C++ because
    143     intltool(xgettext) fails to extract whole strings.
    144 [3] It seem bash 3.0 i18n doesn't work on none UTF-8 so need to convert from UTF-8.
    145 
    146 
    147 How to generate po tarballs
    148 ===========================
    149 
    150 # cd po-sun
    151 # make clean
    152 # make
    153 # cp po-sun-tarballs/* %{_builddir}/SOURCES/.
    154 # pkgbuild --with-build-l10n -bp SUNWfoo.spec
    155 
    156 
    157 How to add a new module
    158 =======================
    159 
    160 # module=foo
    161 # cd %{_builddir}/%{name}-%{version}/$module/po
    162 # intltool-update -m
    163 # cp POTFILES.in POTFILES.in.org
    164 # cat POTFILES.in.orig missing | env LANG=C sort > POTFILES.in
    165 # intltool-update -p
    166 # sed -e 's/#\. .*SUN_BRANDING/# SUN_BRANDING/' ${module}.pot \
    167   > ${module}-sun.pot
    168 # msggrep -C -e "SUN_BRANDING" ${module}-sun.pot -o ${module}-sun.pot
    169 # mkdir -p $SVN/trunk/po-sun/$module/po-sun
    170 # cp ${module}-sun.pot $SVN/trunk/po-sun/$module/po-sun/.
    171 # cd $SVN/trunk/po-sun
    172 # vi Makefile
    173 # diff Makefile.orig Makefile
    174 72a73
    175 > 	foo				\
    176 79a81,83
    177 > foo_PAGES = foo/po-sun
    178 > foo.PAGES: $(foo_PAGES)
    179 > 
    180 # make
    181 # bzcat po-sun-tarballs/foo-po-sun-*.tar.bz2 | tar tfv -
    182 
    183 
    184 How to add/update translations 
    185 ==============================
    186 
    187 Please make sure 'make clean; make' and pkgbuild and commit your .po files 
    188 in the module dir.
    189 
    190 
    191 How to update .spec files
    192 =========================
    193 
    194 Modify spec-files/foo.spec
    195 --- spec-files/foo.spec.orig
    196 +++ spec-files/foo.spec
    197 @@ -7,6 +7,7 @@
    198  #
    199  # Owner: foo
    200  #
    201 +%include l10n.inc
    202  Name:         foo
    203  License:      GPL
    204  Group:        System/GUI/GNOME
    205 @@ -20,6 +21,9 @@
    206  Source2:      gfloppy.1.gz
    207  Source3:      gnome-dictionary.1.gz
    208  Source4:      gnome-screenshot.1.gz
    209 +%if %build_l10n
    210 +Source5:      %{name}-po-sun-%{po_sun_version}.tar.bz2
    211 +%endif
    212  # date:2005-05-02 type:bug bugster:6222777 owner:mattman
    213  Patch1:       gnome-utils-01-gfloppy-permission.diff
    214  # date:2006-04-05 type:branding owner:gman
    215 @@ -63,6 +65,10 @@ This package contains some essential uti
    216  
    217  %prep
    218  %setup -q
    219 +%if %build_l10n
    220 +bzcat %SOURCE5 | tar xf -
    221 +cd po-sun; make; cd ..
    222 +%endif
    223  %patch1 -p1
    224  %patch2 -p1
    225  %patch3 -p1
    226 @@ -159,3 +165,6 @@ done
    227  %{_libdir}/pkgconfig
    228  
    229  %changelog
    230 +* Thu Dec 28 2006 - foo (a] sun.com
    231 +- Add l10n tarball.
    232 +
    233 
    234 
    235 How to delete Sun l10n tarball in .spec files
    236 =============================================
    237 
    238 1. Upstream foo.diff
    239 2. Remove foo-po-sun*.tar.bz2 from .spec files
    240 
    241