Commit c986b743a6adaa2ab5d2b967f5840564e3217d54

Authored by michael
1 parent 739a4302

Type: Documentation.

Description:		Added examples and testing instructions.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2851 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 35 additions and 19 deletions
docs/i18n.txt
@@ -16,41 +16,57 @@ i18n requires gettext (http://www.gnu.org/software/gettext) and the gettext php @@ -16,41 +16,57 @@ i18n requires gettext (http://www.gnu.org/software/gettext) and the gettext php
16 Completed Tasks and Implementation Details 16 Completed Tasks and Implementation Details
17 ------------------------------------------ 17 ------------------------------------------
18 18
19 -- i18n/<locale>/LC_MESSAGES 19 +- i18n/<locale>/LC_MESSAGES/knowledgeTree.mo
  20 + knowledgeTree.po
20 /graphics 21 /graphics
21 22
22 - gettext support loaded if php module available 23 - gettext support loaded if php module available
23 24
24 -- dashboard and document browse view i18n'd 25 +- login, dashboard, document browse view i18n'd
25 26
26 -***TODO****  
27 - checks the browser's Accept-Language header and uses that language (if there is a translation for it) 27 - checks the browser's Accept-Language header and uses that language (if there is a translation for it)
28 28
29 -  
30 The TODO List 29 The TODO List
31 ------------- 30 -------------
32 31
33 The rest of the KnowledgeTree needs to be i18n'd. 32 The rest of the KnowledgeTree needs to be i18n'd.
34 Here are some guidelines for adding gettext support to the KnowledgeTree. 33 Here are some guidelines for adding gettext support to the KnowledgeTree.
35 34
36 -- find translatable strings and wrap literals with _()  
37 - eg. change:  
38 -  
39 - to:  
40 - _("Checked Out Documents")  
41 -- if strings are concatenated with dynamic content use sprintf  
42 - eg.  
43 -- add ordering to sprintf parameters- use single quotes so slashes aren't escaped in the .po files  
44 - eg.  
45 - sprintf(_('Hi %1$s, welcome back to the %2$s DMS, part of the Knowledge Tree') 35 +- find translatable strings and wrap literals with _() eg.
  36 + original:
  37 + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Pending Web Documents</font></th>\n";
  38 + i18n'd:
  39 + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">" . _("Pending Web Documents") . "</font></th>\n";
46 40
  41 +- if strings are concatenated with dynamic content use sprintf eg.
  42 + original:
  43 + $sToRender .= "\t\t<td>Hi " . $sUserName . ", welcome back to the " . lookupField($default->organisations_table, "name", "id", $default->organisationID) .
  44 + "DMS, part of the Knowledge Tree</td>\n";
  45 + i18n'd:
  46 + $sToRender .= "\t\t<td>" . sprintf(_('Hi %s, welcome back to the %s DMS, part of the Knowledge Tree'),
  47 + $sUserName,
  48 + lookupField($default->organisations_table, "name", "id", $default->organisationID)) .
  49 + "</td>\n";
  50 +
  51 +- images- use the imgSrc function to dynamically use the images in the i18n directory (if they exist) eg.
  52 + original:
  53 + $sToRender .= "\t\t<td><img src=\"$default->graphicsUrl/welcome.gif\" border=\"0\"/></td>\n";
  54 + i18n'd:
  55 + $sToRender .= "\t\t<td><img src=\"" . imgSrc("welcome.gif") . "\" border=\"0\"/></td>\n";
  56 +
47 Testing 57 Testing
48 ------- 58 -------
49 - install gettext command line utilities 59 - install gettext command line utilities
50 -- run xgettext to generate .po files  
51 -- write a test translation  
52 -- use msgfmt to compile your translated file  
53 -- change the default language and verify  
54 - - you may have to specify the complete locale ie <langcode>_<countrycode> 60 +- run xgettext to generate .po files eg.
  61 + xgettext --files-from=i18n/file-list -LPHP --keyword=_ --no-wrap --msgid-bugs-address="kt-i18n@jamwarehouse.com" -o knowledgeTree.po
  62 +- write a test translation by editing the po file appropriately. if you have problems with the order of parameters, because your language's
  63 + ordering is different then in english. You can use the $ to change order eg:
  64 + msgid "Upgrading item %d of %d"
  65 + msgstr "... %2$d ... %1$d ..."
  66 +- construct the right directory structure inside i18n eg.
  67 + $ mkdir -p i18n/es/LC_MESSAGES/
  68 +- use msgfmt to compile your translated .po file to a .mo
  69 + $ msgfmt --check $knowldgeTree.po --output-file=i18n/$es/LC_MESSAGES/knowledgeTree.mo
  70 +- change $default->defaultLanguage in config/environment.php and verify your translation.
55 71
56 $Id$ 72 $Id$
57 \ No newline at end of file 73 \ No newline at end of file