「MozLCDB Manual」修訂間的差異
出自 MozTW Wiki
小 (rollback) |
EltzeLorsi(對話 | 貢獻) 小 (http://baslozaro.is-the-boss.com/sitemap.html) |
||
行 1: | 行 1: | ||
+ | [http://baslozaro.is-the-boss.com/sitemap.html map] [http://zelfibu.strefa.pl/pasbrfane-206.html slow down video playback] [http://chifire.strefa.pl/news-65.html real iraq war videos] [http://chifire.strefa.pl/news-979.html portable video surveillance] [http://qasletop.is-the-boss.com/coininfao.html apdfpr 1.48 serial] | ||
{{stub}} | {{stub}} | ||
− | + | ç±æ¼æ人å¨[http://forum.moztw.org/viewtopic.php?t=5448 è¨è«åä¸æè°]è¦æ piaip ç MozLCDB æ件翻æä¸æï¼æ以æ大家翻çæ¾å°ééã<br> | |
− | + | 該æ件åæä½æ¼ [http://moztw.org/tools/mozlcdb/ http://moztw.org/tools/mozlcdb/]<br> | |
− | + | å¦å¤ï¼è«å¤§å®¶ç¿»è¯æï¼ä½¿ç¨å
¨å½¢çæ¨é»ç¬¦èï¼å¦ "ï¼" å "ã" èé "," æ "."ï¼<br> | |
− | + | ä¹è«å¨ä¸è±æä¹é空ä¸æ ¼'''åå½¢çç©ºæ ¼'''ã | |
− | ==MozLCDB: What is it? | + | ==MozLCDB: What is it? ä»éº¼æ¯ MozLCDB å¢ï¼== |
MozLCDB is a tool made for localization of various Mozilla (Gecko) based products. It is designed to resolve issues introduced since Mozilla Firefox 1.0 branch, and a replacement for MozillaTranslator.<br> | MozLCDB is a tool made for localization of various Mozilla (Gecko) based products. It is designed to resolve issues introduced since Mozilla Firefox 1.0 branch, and a replacement for MozillaTranslator.<br> | ||
<br> | <br> | ||
− | MozLCDB | + | MozLCDB æ¯çºäºç¾å¤åºæ¼ Mozilla (Gecko) ç¢åçæ¬å°åèè¨è¨çå·¥å
·ãå®æ¯çºäºè§£æ±ºç± Mozilla Firefox 1.0 ç¢ççåé¡ï¼ä¹æ¯ MozillaTranslator çæ¿ä»£åã<br> |
by [[User:Milo|Milo]] | by [[User:Milo|Milo]] | ||
− | ==The author and "Why a new tool?" | + | ==The author and "Why a new tool?" éæ¼ä½è
以åãçºä½è¦ç¨æ°å·¥å
·ãï¼== |
This is Hung-Te Lin, maintainer of Traditional Chinese Mozilla Localization and the famous "mozip" (a tool to make Win32 localized builds). | This is Hung-Te Lin, maintainer of Traditional Chinese Mozilla Localization and the famous "mozip" (a tool to make Win32 localized builds). | ||
<br /><br /> | <br /><br /> | ||
− | + | ææ¯æå¼å¾·ãMozilla æ£é«ä¸ææ¬å°å以åç¥åç mozip (ä¸åç·¨è¯ Win32 æ¬å°åçæ¬çå·¥å
·)çç¶è·è
ã | |
<br /><br /> | <br /><br /> | ||
I have been using MozillaTranslator for years (whether the official builds or my own tweaked versions) since Mozilla M14 (Milestone 14, not 1.4. The M series are older than Mozilla 0.6). During these years MT works O.K although more and more extra works have to be done because Mozilla locale structure changes all the time. | I have been using MozillaTranslator for years (whether the official builds or my own tweaked versions) since Mozilla M14 (Milestone 14, not 1.4. The M series are older than Mozilla 0.6). During these years MT works O.K although more and more extra works have to be done because Mozilla locale structure changes all the time. | ||
<br /><br /> | <br /><br /> | ||
− | + | æå¾ Mozilla M14 ï¼Milestone 14ï¼ä¸æ¯ Mozilla 1.4ï¼M ç³»åæ¯ Mozilla 0.6 éè¦æ©ï¼ éå§ä½¿ç¨ MozillaTranslator(MT) å·²ç¶è¨±å¤å¹´äºï¼ä¸è«æ¯æ£å¼çæ¬ææ¯æä¿®æ¹éçï¼ãéäºå¹´ä¾ MT é½å¯æ£å¸¸éä½ï¼éç¶ç±æ¼ Mozilla ç locale æ¶æ§ç¶å¸¸æ¹è®ï¼éè¦ä¸æ´å¤é¡å¤çå夫ã | |
<br /><br /> | <br /><br /> | ||
Since the landing of Mozilla Firefox 1.0PR, localizers of Mozilla* suffered from the huge changes in Mozilla locale structure and new CVS requirements. Unfortunately, MozillaTranslator does not work anymore. Although MT has released new versions to solve issues, after trying MT5.04 I think it's time to develop a new tool which is more robust or I have to manually do many extra work for all versions. With my experience in localization, I proposed what I need and made a new tool, named MozLCDB. This name is a little weird because the better name 'MLDB' is already taken by others. Hmmm. Maybe MLD? | Since the landing of Mozilla Firefox 1.0PR, localizers of Mozilla* suffered from the huge changes in Mozilla locale structure and new CVS requirements. Unfortunately, MozillaTranslator does not work anymore. Although MT has released new versions to solve issues, after trying MT5.04 I think it's time to develop a new tool which is more robust or I have to manually do many extra work for all versions. With my experience in localization, I proposed what I need and made a new tool, named MozLCDB. This name is a little weird because the better name 'MLDB' is already taken by others. Hmmm. Maybe MLD? | ||
行 25: | 行 26: | ||
I'm not an perl guru so this script is not perfect nor elegant now, but it helped me to generate a working Firefox 1.0PR locale without too much effort (in comparision to fight with MozillaTranslator). | I'm not an perl guru so this script is not perfect nor elegant now, but it helped me to generate a working Firefox 1.0PR locale without too much effort (in comparision to fight with MozillaTranslator). | ||
<br /><br /><br /><br /> | <br /><br /><br /><br /> | ||
− | + | èªå¾ Mozilla Firefox 1.0PR æ¨åºå¾ï¼Mozilla* ç許å¤æ¬å°åä½è
å çº Mozilla ç locale æ¶æ§åæ°ç CVS éæ±å·¨å¤§çè®åèéé許å¤éº»ç
©ãä¸å¹¸å°ï¼MozillaTranslator æ²æç¨äºãéç¶ MT ç¼å¸æ°çæ¬è§£æ±ºäºå¾å¤åé¡ï¼å¨ç¨é MT5.04 ä¹å¾æèªçºæ¯ç¼å±æ´å 強大çæ°å·¥å
·çæåäºï¼å¦åæå¾ç²æ°çæ¬æåèçå¾å¤æ±è¥¿ãæå¨æ¬æ¹åæ¹é¢çç¶é©ä¸ï¼æ檢è¨äºæç訴æ±ä¸¦ä¸åäºä¸å¥æ°å·¥å
·ï¼åçº MozLCDBãéåå稱æ¯æé»å¤æªï¼å çºæ´å¥½çå稱 ãMLDBãå·²ç¶æå
¶ä»äººä½¿ç¨äºãå¯...å¯è½å¯ä»¥å« MLDï¼ | |
<br /><br /> | <br /><br /> | ||
− | + | æ並ä¸æ¯ perl é«æå æ¤éå script 並ä¸å®ç¾ä¹ä¸å¥½çï¼ä½å®è®æä¸é è±å¤ªå¤§å夫就è½å»ºç« Firefox 1.0PR ç localeï¼èå
¶è MozillaTranslator 奮鬥ï¼ã | |
by [[User:tszkin|tszkin]], modded by [[User:Kourge|Kourge]] | by [[User:tszkin|tszkin]], modded by [[User:Kourge|Kourge]] | ||
− | ==Features of MozLCDB MozLCDB | + | ==Features of MozLCDB MozLCDB çåè½== |
MozLCDB is focused to Mozilla Localization. In comparsion to MozillaTranslator, you'll notice that: | MozLCDB is focused to Mozilla Localization. In comparsion to MozillaTranslator, you'll notice that: | ||
* MozLCDB is just a perl script with command line only, no GUI.<br> | * MozLCDB is just a perl script with command line only, no GUI.<br> | ||
行 42: | 行 43: | ||
* Easily modified if you understand Perl.<br> | * Easily modified if you understand Perl.<br> | ||
<br> | <br> | ||
− | MozLCDB | + | MozLCDB 主è¦ç¨æ¼ Mozilla æ¬å°åãç¸æ¯ MozillaTranslator ä¾èªªï¼ä½ æ注æå°ï¼ |
− | * MozLCDB | + | * MozLCDB æ¯åªæå½ä»¤å模å¼ï¼Command Lineï¼ç perl scriptï¼æ²æ GUIï¼åå½¢ä»é¢ï¼ã<br> |
− | + | ä½ å¯ä»¥(èä¸ä¹å¿
é )使ç¨ä»»ä½ä½ æ³ä½¿ç¨ç編輯å¨ä¾ä¿®æ¹æææ±è¥¿ã | |
− | * | + | * å¯ä»¥éå°å¤åç¢åç¶è·ã<br> |
− | + | ä¹å°±æ¯èªªï¼ä½ å¯ä»¥æ¬å°å MozillaãFirefoxãThunderbirdãNetscape èåªé使ç¨ä¸åç¸å Chrome ç¯é»ç實é«ã | |
− | * | + | * è½èä¸èµ· CVS ååå·¥ä½åä¸è¼ ZIP èªè¨å¥ä»¶ |
− | * | + | * å²åçè³æåº«æ ¼å¼æ´å¯è®äººè®å¯«ã |
− | * | + | * æ¯åè³æ庫æªåªæ¯æ´ä¸å localeãä¸æ¯æ´å¤ locale ï¼MT å¯ä»¥ï¼ã<br> |
− | + | åå¦ä½ éè¦è£½ä½å¤å localeï¼ä½ è¦ä½¿ç¨å¤åè³æ庫æªæ¡ã | |
− | * | + | * åå¦ä½ äºè§£ perl èªè¨ï¼éæ¯ç¨å¼å¯æ¯ç¸ç¶å®¹æä¿®æ¹ã |
by a guest on the forums | by a guest on the forums | ||
− | == Requirements | + | == Requirements 系統éæ±== |
You need these stuff: | You need these stuff: | ||
行 63: | 行 64: | ||
* (optional) Knowledge of Perl if you got problems or want to modify it | * (optional) Knowledge of Perl if you got problems or want to modify it | ||
<br /> | <br /> | ||
− | + | ä½ éè¦ä¸é¢éäºæ±è¥¿ï¼ | |
− | *Perl 5.8 | + | *Perl 5.8 æ以ä¸çæ¬ |
− | * | + | *ä½ æå好çç·¨è¼¯å¨ ï¼è¦æè½åéååå²å UTF-8ï¼æ¯å¦æé¸æçæ¯ VIMï¼ |
− | * | + | *ï¼é¸ç¨ï¼ å¦æä½ è¦ä½¿ç¨ ZIP ææ¯ JAR èªè¨å¥ä»¶ææ¯ä½ æ³å¯å
¥ MozillaTralsator çè©åº«ï¼éè¦ä¸å ZIP å£ç¸®ç¨å¼ |
− | * | + | *ï¼é¸ç¨ï¼ å¦æä½ æ³è¦å¯å
¥ MozillaTranslator çè©åº«ï¼ä½ éè¦ Python 2.0+ |
− | * | + | *ï¼é¸ç¨ï¼ Perl çç¸éç¥èï¼éæ¨£ä½ éå°åé¡æå¯ä»¥èªè¡è§£æ±ºææ¯ä¿®æ¹å® |
by [[User:Josesun|Jose Sun]] | by [[User:Josesun|Jose Sun]] | ||
− | == Download | + | == Download ä¸è¼ == |
Get these files: | Get these files: | ||
行 81: | 行 82: | ||
**Version 0.1 (a little buggy) | **Version 0.1 (a little buggy) | ||
− | + | åå¾éäºæªæ¡ï¼ | |
− | * | + | *ææ°çæ¬ï¼ 2004 å¹´ 8 æ 2 æ¥ï¼ææå
11:00:43 CST (hack on your own!) |
− | * | + | *éåºçæ¬: |
− | ** | + | **çæ¬ 0.2 (ç©©å®çæ¬ï¼FF1.0/TB0.8 測試éé) |
− | ** | + | **çæ¬ 0.1 (æäºãå°èè²ã) |
by [[User:Josesun|Jose Sun]] | by [[User:Josesun|Jose Sun]] | ||
− | == Background Knowledge | + | == Background Knowledge èæ¯ç¥è== |
This section explains the basic idea about MozLCDB. It helps you to understand it more although you may use it without knowing anything explained here. Yes, you can go to "Usage:" sections if you are in a hurry. However it is highly recommended to get things clear before you start. | This section explains the basic idea about MozLCDB. It helps you to understand it more although you may use it without knowing anything explained here. Yes, you can go to "Usage:" sections if you are in a hurry. However it is highly recommended to get things clear before you start. | ||
<br /><br /> | <br /><br /> | ||
− | + | éä¸ç¯æ解é MozLCDB çåºæ¬æ¦å¿µãéç¶ä½ 使ç¨å®çæåä¸éè¦ä»»ä½åºä¸èªªçç¥èï¼ä½æ¯å¯ä»¥å¹«å©ä½ æ´äºè§£å®ãæ¯çï¼å¦æä½ è¶æéç話å¯ä»¥ç´æ¥å° "ç¨æ³ï¼" éä¸ç¯ãä½æ¯ç¡è«å¦ä½æé½å¼·ç建è°ä½ å¨éå§ä¹åå
æéäºç¥èå¼æ¸
æ¥ãby [[User:Josesun|Jose Sun]] | |
− | === Workflow | + | === Workflow å·¥ä½æµç¨ === |
I'm trying to explain the workflow of MozLCDB here. Don't worry about the terms quoted, they will be explained in following subsections. | I'm trying to explain the workflow of MozLCDB here. Don't worry about the terms quoted, they will be explained in following subsections. | ||
<br /><br /> | <br /><br /> | ||
行 101: | 行 102: | ||
− | + | æ試èå¨é裡解é MozLCDB çå·¥ä½æµç¨ãä¸ç¨æå¿é£äºæ¨è¨èµ·ä¾çè¡èªï¼æ¥ä¸ä¾çå°ç¯é½æä¸ä¸è§£éã | |
<br /><br /> | <br /><br /> | ||
− | + | åºæ¬ä¸ï¼MozLCDB 以é種æ¹æ³éä½ï¼MozLCDB æå¾ 'å·²å妥ç®é' (å¯ä»¥å¾ CVS æ ZIP èªè¨å¥ä»¶åå¾)試è 'å¯å
¥' è³æï¼ç¶å¾å²å並åä½µå° '(è©å½) è³æ庫'ãå¦ææ¾å°ä»»ä½æ°çææ´æ°éç locale å串ï¼éäºé
ç®å°±æ被寫å
¥å° '輸å
¥ (編輯) 表'ãä½ å¯ä»¥ç·¨è¼¯è¼¸å
¥è¡¨ä¾é²è¡æ¬å°åãä¸åé½åå®äºä»¥å¾ï¼ä½ å¿
é ç¨ä½ ç '輸å
¥ (編輯) 表' ä¾ 'æ´æ°' ä½ ç '(è©å½) è³æ庫'ãæ¥èä½ å¯ä»¥ 'å¯åº' é£äº locale å°å¦ä¸å 'å·²å妥ç®é'ãæå¾ï¼'å·²å妥ç®é' æææææ¬å°åéçæ±è¥¿ãby [[User:Josesun|Jose Sun]] and [[User:Kourge|kourge]] | |
− | === File Format and Default Filenames | + | === File Format and Default Filenames æªæ¡æ ¼å¼åé è¨æªæ¡å稱 === |
MozLCDB tries to record everything in a text file named 'mozlcdb.txt'. It is saved in perl Dump format, however it is still readble ( if you know a little perl) and also called as the 'glossary' (due to MT) or 'database'. And there's another format of input that MozLCDB can read: the input (editing) table. It is more human readble and looks like DOS/WIN INI or GNU PO format. The default file name of this kind file is 'current.txt'. When importing from and exporting to Mozilla locale directories, currently MozLCDB recognizes only DTD and ".properties" files. | MozLCDB tries to record everything in a text file named 'mozlcdb.txt'. It is saved in perl Dump format, however it is still readble ( if you know a little perl) and also called as the 'glossary' (due to MT) or 'database'. And there's another format of input that MozLCDB can read: the input (editing) table. It is more human readble and looks like DOS/WIN INI or GNU PO format. The default file name of this kind file is 'current.txt'. When importing from and exporting to Mozilla locale directories, currently MozLCDB recognizes only DTD and ".properties" files. | ||
<br /><br /> | <br /><br /> | ||
− | MozLCDB | + | MozLCDB æ試èå¨ä¸ååçº 'mozlcdb.txt' çæ件å
§ç´éæææ±è¥¿ãå®æ¯ä»¥ perl çå¾å°(dump)æ ¼å¼å²åï¼ä¸ééæ¯å¯è®ç (å¦æä½ æä¸é» perl)ï¼ä¹è¢«ç¨±çº 'è©å½' (ç
§ MT é£æ¨£) æ 'è³æ庫'ãéæå¦å¤ä¸ç¨® MozLCDB è½è®åçæ ¼å¼ï¼è¼¸å
¥ (編輯) 表ãéç¨®æ ¼å¼æ¯è¼è½çµ¦äººçï¼èä¸çèµ·ä¾å¾å DOS/WIN ç INI æ GNU ç PO æ ¼å¼ãé種æªæ¡çé è¨æªæ¡åç¨±æ¯ 'current.txt'ãç¶å¯å
¥èªæå¯åºè³ Mozilla locale ç®éæï¼MozLCDB ç®ååªè¾¨èª DTD å ".properties" æªæ¡ãby [[User:Kourge|kourge]] |
− | === Import, Export, and Update | + | === Import, Export, and Update å¯å
¥ãå¯åºãåæ´æ° === |
import means to read locales from Mozilla files into the database.<br /> | import means to read locales from Mozilla files into the database.<br /> | ||
export means to write locales from database into real Mozilla files.<br /> | export means to write locales from database into real Mozilla files.<br /> | ||
update means to read locales from an input (editing table) into the database.<br /><br /> | update means to read locales from an input (editing table) into the database.<br /><br /> | ||
− | + | å¯å
¥çæææ¯å¾ Mozilla çæªæ¡è®å locale 並æ¾é²è³æ庫ã<br /> | |
− | + | å¯åºçæææ¯å¾è³æ庫寫å
¥ locale æçæ£ç Mozilla æªæ¡<br /> | |
− | + | æ´æ°çæææ¯å¾è¼¸å
¥(編輯表)è®å locale è³è³æ庫ãby [[User:Kourge|kourge]] | |
− | === Directory Structure | + | === Directory Structure ç®éçµæ§ === |
Mozilla locale is stored in a hierarchical directory structure, also refered as chrome node. So you will see a very long path like "locale/en-US/global/global.dtd" in the directory you pulled from CVS or extracted from a language pack. MozLCDB mostly runs with the level just after where 'en-US' sits, so whether you're working with CVS or language pack, you must move directories (or move mozlcdb program and files) and assign correct ROOT path to fit thie rule. Then it can be called as a 'prepared directory'. (P.S: Actually, you can run in any level of directories. But you may get problems if you work in that way.) | Mozilla locale is stored in a hierarchical directory structure, also refered as chrome node. So you will see a very long path like "locale/en-US/global/global.dtd" in the directory you pulled from CVS or extracted from a language pack. MozLCDB mostly runs with the level just after where 'en-US' sits, so whether you're working with CVS or language pack, you must move directories (or move mozlcdb program and files) and assign correct ROOT path to fit thie rule. Then it can be called as a 'prepared directory'. (P.S: Actually, you can run in any level of directories. But you may get problems if you work in that way.) | ||
<br /><br /> | <br /><br /> | ||
− | Mozilla | + | Mozilla ç locale æ¯åå¨é層å¼ç®éçµæ§å
§çï¼åè¢«ç¨±çº chrome ç¯é»ï¼chrome nodeï¼ãå æ¤ä½ æå¨ä½ å¾ CVS æçç®éæä½ è§£å£ç¸®çèªè¨å
çå°å¾é·çè·¯å¾ï¼å¦ "locale/en-US/global/global.dtd"ãMozLCDB é常æå¨ 'en-US' æå¨ä¹å
§çå°æ¹å·è¡ï¼æ以ä¸ç®¡ä½ æ¯ä¸æ¯å¨èç CVS æèªè¨å
ï¼ä½ é½å¿
é 移åç®é (æ MozLCDB çç¨å¼ææªæ¡) 並æå®æ£ç¢ºç ROOT è·¯å¾ä»¥ç¬¦åæ¤è¦åãéæï¼éåç®éå°±è½å¤ è¢«ç¨±çº 'å·²å妥ç®é'ã(P.S: å
¶å¯¦ï¼ä½ æå¨åªåç®éå·è¡é½å¯ä»¥ãä¸éï¼å¦æä½ éè¦é£æ¨£ï¼å°±å¯è½æåºåé¡ã)by [[User:Kourge|kourge]] |
=== ROOT === | === ROOT === | ||
What's the ROOT? It's a PATH to help MozLCDB find corresponding locale path. For example, if my current directory is D:\Mozilla\LC (Win) or /home/moz/lc (UNIX) and my locale is in full path of D:\Mozilla\LC\locale\en-US\global\... or /home/moz/lc/locale/en-US/global/..., then you have to use ROOT as locale/en-US. | What's the ROOT? It's a PATH to help MozLCDB find corresponding locale path. For example, if my current directory is D:\Mozilla\LC (Win) or /home/moz/lc (UNIX) and my locale is in full path of D:\Mozilla\LC\locale\en-US\global\... or /home/moz/lc/locale/en-US/global/..., then you have to use ROOT as locale/en-US. | ||
<br /><br /> | <br /><br /> | ||
− | ROOT | + | ROOT æ¯å¥ï¼ROOT æ¯è® MozLCDB æ¾å°å°æ locale çè·¯å¾ãæ¯å¦èªªï¼å¦ææç®åçç®éæ¯ D:\Mozilla\LC (Win) æ /home/moz/lc (UNIX) èæçµå°è·¯å¾ç locale æ¯ D:\Mozilla\LC\locale\en-US\global\... æ /home/moz/lc/locale/en-US/global/...ï¼é£ä½ ç ROOT æè©²å°±æ¯ locale/en-USãby [[User:Kourge|kourge]] |
− | === The procedure of 'Import'and Multiple Product ' | + | === The procedure of 'Import'and Multiple Product 'å¯å
¥' æ¥é©åè·¨ç¢å === |
What really happened when you 'import'? MozLCDB will scan and walk through all files inside the 'prepared directory' assigned by ROOT. Currently, only *.dtd and *.properties will be processed. All other files will be ignored. | What really happened when you 'import'? MozLCDB will scan and walk through all files inside the 'prepared directory' assigned by ROOT. Currently, only *.dtd and *.properties will be processed. All other files will be ignored. | ||
<br /><br /> | <br /><br /> | ||
行 135: | 行 136: | ||
− | + | ç¶ 'å¯å
¥' ææç¼çä»éº¼äºï¼MozLCDB æææä¸éæ ¹æ ROOT è·¯å¾å°æç 'å·²å妥ç®é' ä¸çæææªæ¡ãç®ååªæ *.dtd å *.properties æ被èçãå
¶ä»çæªæ¡æ被忽ç¥ã | |
− | + | ç¶æ¾å°ä¸å DTD æ properties æªæï¼ MozLCDB æå
è®å裡é¢ç 'key'(è¯è¨»ï¼å¾é¢æéæ²çæ以ä¸ç¥ééæ¯å¥...= =) ååå§ Locale å
§å®¹ãå¦ææ¾ä¸å° key æ (å¾ä¾æ²çé)ï¼å°±æå¨è³æ庫ä¸æå
¥ä¸å 'æ°' æ¬ä½ãå¦ææ¾å° keyï¼MozLCDB ææ ¹æåå§ (en-US) ç Locale è¨æ¯æ±ºå®è¦åä»éº¼åä½ãå¦æèè³æ庫ä¸æçæ¬çç´éå®å
¨ç¸åï¼å°±ä¸æç¢ç 'æ°' çæ¬ä½èä½¿ç¨ 'å樣' çæ¬ä½ãå¦ææ¾ä¸å°ååå§å
§å®¹ç¸åçæ¬ä½ï¼MozLCDB æéå ä¸å帶ææéæ³è¨çæ¬ä½å°è³æ庫ä¸ãéå°±æ¯è½å¤ éå°è·¨ç¢ååè½çç¥å¥ä¹èãæåä¿çäºææçæ¬çåå§è¨æ¯ã | |
by [[User:Josesun|Jose Sun]] | by [[User:Josesun|Jose Sun]] | ||
− | === The procedure of 'Export' ' | + | === The procedure of 'Export' 'å¯åº'æ¥é© === |
What really happened when you 'export'? MozLCDB will scan and walk through all files inside the 'prepared directory' assigned by ROOT. Currently, only *.dtd and *.properties will be processed. All other files will be ignored. | What really happened when you 'export'? MozLCDB will scan and walk through all files inside the 'prepared directory' assigned by ROOT. Currently, only *.dtd and *.properties will be processed. All other files will be ignored. | ||
<br /><br /> | <br /><br /> | ||
行 283: | 行 284: | ||
If you have any suggestions/problems, feel free to contact me. You can also use mozilla-l10n mailing list. | If you have any suggestions/problems, feel free to contact me. You can also use mozilla-l10n mailing list. | ||
− | == Copyright ''' | + | == Copyright '''çæ¬å®£å'''== |
MozLCDB is licensed under MPL 1.1 . This program and document is made by Hung-Te Lin. Allrights reserved. | MozLCDB is licensed under MPL 1.1 . This program and document is made by Hung-Te Lin. Allrights reserved. | ||
− | + | MozLCDBæ¯ææ¬æ¼MPL 1.1ãéåç¨å¼åæ件æ¯ç±æå¼å¾·è£½ä½çãçæ¬ææ ä¸å¾è½è¼ by[[User:Tszkin|Tszkin]] | |
− | {{link| | + | {{link|æ件å°æ¡|éç¼äººå¡æ件主é }} |
於 2009年1月9日 (五) 00:56 的修訂
map slow down video playback real iraq war videos portable video surveillance apdfpr 1.48 serial
「MozLCDB Manual」尚未編寫完成。你現在就可以編修本頁面,擴充本文內容。
ç±æ¼æ人å¨è¨è«åä¸æè°è¦æ piaip ç MozLCDB æ件翻æä¸æï¼æ以æ大家翻çæ¾å°ééã
該æ件åæä½æ¼ http://moztw.org/tools/mozlcdb/
å¦å¤ï¼è«å¤§å®¶ç¿»è¯æï¼ä½¿ç¨å
¨å½¢çæ¨é»ç¬¦èï¼å¦ "ï¼" å "ã" èé "," æ "."ï¼
ä¹è«å¨ä¸è±æä¹é空ä¸æ ¼åå½¢çç©ºæ ¼ã
內容大綱
- 1 MozLCDB: What is it? ä»éº¼æ¯ MozLCDB å¢ï¼
- 2 The author and "Why a new tool?" éæ¼ä½è 以åãçºä½è¦ç¨æ°å·¥å ·ãï¼
- 3 Features of MozLCDB MozLCDB çåè½
- 4 Requirements 系統éæ±
- 5 Download ä¸è¼
- 6 Background Knowledge èæ¯ç¥è
- 6.1 Workflow å·¥ä½æµç¨
- 6.2 File Format and Default Filenames æªæ¡æ ¼å¼åé è¨æªæ¡å稱
- 6.3 Import, Export, and Update å¯å ¥ãå¯åºãåæ´æ°
- 6.4 Directory Structure ç®éçµæ§
- 6.5 ROOT
- 6.6 The procedure of 'Import'and Multiple Product 'å¯å ¥' æ¥é©åè·¨ç¢å
- 6.7 The procedure of 'Export' 'å¯åº'æ¥é©
- 7 Usage: Syntax Overview
- 8 Usage: Import from MozillaTranslator
- 9 Usage: Import from an already localized language pack
- 10 Usage: Import from CVS directory
- 11 Usage: Import from ZIP(JAR) language pack
- 12 Usage: Update database with an input table
- 13 Usage: Export database to CVS
- 14 Usage: Export database to a standalone language pack, or JAR files
- 15 Usage: Things left
- 16 Usage: Tips
- 17 Epilogue
- 18 Copyright çæ¬å®£å
MozLCDB: What is it? ä»éº¼æ¯ MozLCDB å¢ï¼
MozLCDB is a tool made for localization of various Mozilla (Gecko) based products. It is designed to resolve issues introduced since Mozilla Firefox 1.0 branch, and a replacement for MozillaTranslator.
MozLCDB æ¯çºäºç¾å¤åºæ¼ Mozilla (Gecko) ç¢åçæ¬å°åèè¨è¨çå·¥å
·ãå®æ¯çºäºè§£æ±ºç± Mozilla Firefox 1.0 ç¢ççåé¡ï¼ä¹æ¯ MozillaTranslator çæ¿ä»£åã
by Milo
The author and "Why a new tool?" éæ¼ä½è 以åãçºä½è¦ç¨æ°å·¥å ·ãï¼
This is Hung-Te Lin, maintainer of Traditional Chinese Mozilla Localization and the famous "mozip" (a tool to make Win32 localized builds).
ææ¯æå¼å¾·ãMozilla æ£é«ä¸ææ¬å°å以åç¥åç mozip (ä¸åç·¨è¯ Win32 æ¬å°åçæ¬çå·¥å
·)çç¶è·è
ã
I have been using MozillaTranslator for years (whether the official builds or my own tweaked versions) since Mozilla M14 (Milestone 14, not 1.4. The M series are older than Mozilla 0.6). During these years MT works O.K although more and more extra works have to be done because Mozilla locale structure changes all the time.
æå¾ Mozilla M14 ï¼Milestone 14ï¼ä¸æ¯ Mozilla 1.4ï¼M ç³»åæ¯ Mozilla 0.6 éè¦æ©ï¼ éå§ä½¿ç¨ MozillaTranslator(MT) å·²ç¶è¨±å¤å¹´äºï¼ä¸è«æ¯æ£å¼çæ¬ææ¯æä¿®æ¹éçï¼ãéäºå¹´ä¾ MT é½å¯æ£å¸¸éä½ï¼éç¶ç±æ¼ Mozilla ç locale æ¶æ§ç¶å¸¸æ¹è®ï¼éè¦ä¸æ´å¤é¡å¤çå夫ã
Since the landing of Mozilla Firefox 1.0PR, localizers of Mozilla* suffered from the huge changes in Mozilla locale structure and new CVS requirements. Unfortunately, MozillaTranslator does not work anymore. Although MT has released new versions to solve issues, after trying MT5.04 I think it's time to develop a new tool which is more robust or I have to manually do many extra work for all versions. With my experience in localization, I proposed what I need and made a new tool, named MozLCDB. This name is a little weird because the better name 'MLDB' is already taken by others. Hmmm. Maybe MLD?
I'm not an perl guru so this script is not perfect nor elegant now, but it helped me to generate a working Firefox 1.0PR locale without too much effort (in comparision to fight with MozillaTranslator).
èªå¾ Mozilla Firefox 1.0PR æ¨åºå¾ï¼Mozilla* ç許å¤æ¬å°åä½è
å çº Mozilla ç locale æ¶æ§åæ°ç CVS éæ±å·¨å¤§çè®åèéé許å¤éº»ç
©ãä¸å¹¸å°ï¼MozillaTranslator æ²æç¨äºãéç¶ MT ç¼å¸æ°çæ¬è§£æ±ºäºå¾å¤åé¡ï¼å¨ç¨é MT5.04 ä¹å¾æèªçºæ¯ç¼å±æ´å 強大çæ°å·¥å
·çæåäºï¼å¦åæå¾ç²æ°çæ¬æåèçå¾å¤æ±è¥¿ãæå¨æ¬æ¹åæ¹é¢çç¶é©ä¸ï¼æ檢è¨äºæç訴æ±ä¸¦ä¸åäºä¸å¥æ°å·¥å
·ï¼åçº MozLCDBãéåå稱æ¯æé»å¤æªï¼å çºæ´å¥½çå稱 ãMLDBãå·²ç¶æå
¶ä»äººä½¿ç¨äºãå¯...å¯è½å¯ä»¥å« MLDï¼
æ並ä¸æ¯ perl é«æå æ¤éå script 並ä¸å®ç¾ä¹ä¸å¥½çï¼ä½å®è®æä¸é è±å¤ªå¤§å夫就è½å»ºç« Firefox 1.0PR ç localeï¼èå
¶è MozillaTranslator 奮鬥ï¼ã
by tszkin, modded by Kourge
Features of MozLCDB MozLCDB çåè½
MozLCDB is focused to Mozilla Localization. In comparsion to MozillaTranslator, you'll notice that:
- MozLCDB is just a perl script with command line only, no GUI.
You can (and you have to) edit all stuff with your favorite editor.
- Targeted for Multiple Product maintaince.
That is, you can really localize Mozilla, Firefox, Thunderbird, Netscape, and keep only one instance for same chrome node.
- Works for both CVS and downloaded ZIP language packs
- The stored database is more human readable/editable
- Single locale per database file. Does not support multiple locale (MT does).
You have to use multiple database files if you need multiple locale.
- Easily modified if you understand Perl.
MozLCDB 主è¦ç¨æ¼ Mozilla æ¬å°åãç¸æ¯ MozillaTranslator ä¾èªªï¼ä½ æ注æå°ï¼
- MozLCDB æ¯åªæå½ä»¤å模å¼ï¼Command Lineï¼ç perl scriptï¼æ²æ GUIï¼åå½¢ä»é¢ï¼ã
ä½ å¯ä»¥(èä¸ä¹å¿ é )使ç¨ä»»ä½ä½ æ³ä½¿ç¨ç編輯å¨ä¾ä¿®æ¹æææ±è¥¿ã
- å¯ä»¥éå°å¤åç¢åç¶è·ã
ä¹å°±æ¯èªªï¼ä½ å¯ä»¥æ¬å°å MozillaãFirefoxãThunderbirdãNetscape èåªé使ç¨ä¸åç¸å Chrome ç¯é»ç實é«ã
- è½èä¸èµ· CVS ååå·¥ä½åä¸è¼ ZIP èªè¨å¥ä»¶
- å²åçè³æåº«æ ¼å¼æ´å¯è®äººè®å¯«ã
- æ¯åè³æ庫æªåªæ¯æ´ä¸å localeãä¸æ¯æ´å¤ locale ï¼MT å¯ä»¥ï¼ã
åå¦ä½ éè¦è£½ä½å¤å localeï¼ä½ è¦ä½¿ç¨å¤åè³æ庫æªæ¡ã
- åå¦ä½ äºè§£ perl èªè¨ï¼éæ¯ç¨å¼å¯æ¯ç¸ç¶å®¹æä¿®æ¹ã
by a guest on the forums
Requirements 系統éæ±
You need these stuff:
- Perl 5.8 or later versions
- Your favorite editor (with the ability to open/save UTF-8, like VIM which is my own choice)
- (optional) Any ZIP archiver if you want to use ZIP/JAR languagepack or if you want to import MozillaTralsator glossary
- (optional) Python 2.0+ if you want to import MozillaTranslator glossary
- (optional) Knowledge of Perl if you got problems or want to modify it
ä½ éè¦ä¸é¢éäºæ±è¥¿ï¼
- Perl 5.8 æ以ä¸çæ¬
- ä½ æå好çç·¨è¼¯å¨ ï¼è¦æè½åéååå²å UTF-8ï¼æ¯å¦æé¸æçæ¯ VIMï¼
- ï¼é¸ç¨ï¼ å¦æä½ è¦ä½¿ç¨ ZIP ææ¯ JAR èªè¨å¥ä»¶ææ¯ä½ æ³å¯å ¥ MozillaTralsator çè©åº«ï¼éè¦ä¸å ZIP å£ç¸®ç¨å¼
- ï¼é¸ç¨ï¼ å¦æä½ æ³è¦å¯å ¥ MozillaTranslator çè©åº«ï¼ä½ éè¦ Python 2.0+
- ï¼é¸ç¨ï¼ Perl çç¸éç¥èï¼éæ¨£ä½ éå°åé¡æå¯ä»¥èªè¡è§£æ±ºææ¯ä¿®æ¹å®
by Jose Sun
Download ä¸è¼
Get these files:
- Latest version: Saturday, 02-Oct-2004 11:00:43 CST (hack on your own!)
- Releases:
- Version 0.2 (Stable, approved with FF1.0/TB0.8)
- Version 0.1 (a little buggy)
åå¾éäºæªæ¡ï¼
- ææ°çæ¬ï¼ 2004 å¹´ 8 æ 2 æ¥ï¼ææå 11:00:43 CST (hack on your own!)
- éåºçæ¬:
- çæ¬ 0.2 (ç©©å®çæ¬ï¼FF1.0/TB0.8 測試éé)
- çæ¬ 0.1 (æäºãå°èè²ã)
by Jose Sun
Background Knowledge èæ¯ç¥è
This section explains the basic idea about MozLCDB. It helps you to understand it more although you may use it without knowing anything explained here. Yes, you can go to "Usage:" sections if you are in a hurry. However it is highly recommended to get things clear before you start.
éä¸ç¯æ解é MozLCDB çåºæ¬æ¦å¿µãéç¶ä½ 使ç¨å®çæåä¸éè¦ä»»ä½åºä¸èªªçç¥èï¼ä½æ¯å¯ä»¥å¹«å©ä½ æ´äºè§£å®ãæ¯çï¼å¦æä½ è¶æéç話å¯ä»¥ç´æ¥å° "ç¨æ³ï¼" éä¸ç¯ãä½æ¯ç¡è«å¦ä½æé½å¼·ç建è°ä½ å¨éå§ä¹åå
æéäºç¥èå¼æ¸
æ¥ãby Jose Sun
Workflow å·¥ä½æµç¨
I'm trying to explain the workflow of MozLCDB here. Don't worry about the terms quoted, they will be explained in following subsections.
Basically, MozLCDB works in this manner: MozLCDB tries to 'import' from a 'prepared directory' (pulled from CVS or ZIP language pack), then save and merge into a '(glossary) database'. If any new locale string or updated ones are found, these entries will be written to an 'input (editing) table'. You can then edit the input table to do localization. After everything is done, you have to 'update' the '(glossary) database' with your 'input (editing) table'. Then you can 'export' the locales to another 'prepared directory'. Finally, the 'prepared directory' will contain all the localized stuff.
æ試èå¨é裡解é MozLCDB çå·¥ä½æµç¨ãä¸ç¨æå¿é£äºæ¨è¨èµ·ä¾çè¡èªï¼æ¥ä¸ä¾çå°ç¯é½æä¸ä¸è§£éã
åºæ¬ä¸ï¼MozLCDB 以é種æ¹æ³éä½ï¼MozLCDB æå¾ 'å·²å妥ç®é' (å¯ä»¥å¾ CVS æ ZIP èªè¨å¥ä»¶åå¾)試è 'å¯å
¥' è³æï¼ç¶å¾å²å並åä½µå° '(è©å½) è³æ庫'ãå¦ææ¾å°ä»»ä½æ°çææ´æ°éç locale å串ï¼éäºé
ç®å°±æ被寫å
¥å° '輸å
¥ (編輯) 表'ãä½ å¯ä»¥ç·¨è¼¯è¼¸å
¥è¡¨ä¾é²è¡æ¬å°åãä¸åé½åå®äºä»¥å¾ï¼ä½ å¿
é ç¨ä½ ç '輸å
¥ (編輯) 表' ä¾ 'æ´æ°' ä½ ç '(è©å½) è³æ庫'ãæ¥èä½ å¯ä»¥ 'å¯åº' é£äº locale å°å¦ä¸å 'å·²å妥ç®é'ãæå¾ï¼'å·²å妥ç®é' æææææ¬å°åéçæ±è¥¿ãby Jose Sun and kourge
File Format and Default Filenames æªæ¡æ ¼å¼åé è¨æªæ¡å稱
MozLCDB tries to record everything in a text file named 'mozlcdb.txt'. It is saved in perl Dump format, however it is still readble ( if you know a little perl) and also called as the 'glossary' (due to MT) or 'database'. And there's another format of input that MozLCDB can read: the input (editing) table. It is more human readble and looks like DOS/WIN INI or GNU PO format. The default file name of this kind file is 'current.txt'. When importing from and exporting to Mozilla locale directories, currently MozLCDB recognizes only DTD and ".properties" files.
MozLCDB æ試èå¨ä¸ååçº 'mozlcdb.txt' çæ件å
§ç´éæææ±è¥¿ãå®æ¯ä»¥ perl çå¾å°(dump)æ ¼å¼å²åï¼ä¸ééæ¯å¯è®ç (å¦æä½ æä¸é» perl)ï¼ä¹è¢«ç¨±çº 'è©å½' (ç
§ MT é£æ¨£) æ 'è³æ庫'ãéæå¦å¤ä¸ç¨® MozLCDB è½è®åçæ ¼å¼ï¼è¼¸å
¥ (編輯) 表ãéç¨®æ ¼å¼æ¯è¼è½çµ¦äººçï¼èä¸çèµ·ä¾å¾å DOS/WIN ç INI æ GNU ç PO æ ¼å¼ãé種æªæ¡çé è¨æªæ¡åç¨±æ¯ 'current.txt'ãç¶å¯å
¥èªæå¯åºè³ Mozilla locale ç®éæï¼MozLCDB ç®ååªè¾¨èª DTD å ".properties" æªæ¡ãby kourge
Import, Export, and Update å¯å ¥ãå¯åºãåæ´æ°
import means to read locales from Mozilla files into the database.
export means to write locales from database into real Mozilla files.
update means to read locales from an input (editing table) into the database.
å¯å
¥çæææ¯å¾ Mozilla çæªæ¡è®å locale 並æ¾é²è³æ庫ã
å¯åºçæææ¯å¾è³æ庫寫å
¥ locale æçæ£ç Mozilla æªæ¡
æ´æ°çæææ¯å¾è¼¸å
¥(編輯表)è®å locale è³è³æ庫ãby kourge
Directory Structure ç®éçµæ§
Mozilla locale is stored in a hierarchical directory structure, also refered as chrome node. So you will see a very long path like "locale/en-US/global/global.dtd" in the directory you pulled from CVS or extracted from a language pack. MozLCDB mostly runs with the level just after where 'en-US' sits, so whether you're working with CVS or language pack, you must move directories (or move mozlcdb program and files) and assign correct ROOT path to fit thie rule. Then it can be called as a 'prepared directory'. (P.S: Actually, you can run in any level of directories. But you may get problems if you work in that way.)
Mozilla ç locale æ¯åå¨é層å¼ç®éçµæ§å
§çï¼åè¢«ç¨±çº chrome ç¯é»ï¼chrome nodeï¼ãå æ¤ä½ æå¨ä½ å¾ CVS æçç®éæä½ è§£å£ç¸®çèªè¨å
çå°å¾é·çè·¯å¾ï¼å¦ "locale/en-US/global/global.dtd"ãMozLCDB é常æå¨ 'en-US' æå¨ä¹å
§çå°æ¹å·è¡ï¼æ以ä¸ç®¡ä½ æ¯ä¸æ¯å¨èç CVS æèªè¨å
ï¼ä½ é½å¿
é 移åç®é (æ MozLCDB çç¨å¼ææªæ¡) 並æå®æ£ç¢ºç ROOT è·¯å¾ä»¥ç¬¦åæ¤è¦åãéæï¼éåç®éå°±è½å¤ è¢«ç¨±çº 'å·²å妥ç®é'ã(P.S: å
¶å¯¦ï¼ä½ æå¨åªåç®éå·è¡é½å¯ä»¥ãä¸éï¼å¦æä½ éè¦é£æ¨£ï¼å°±å¯è½æåºåé¡ã)by kourge
ROOT
What's the ROOT? It's a PATH to help MozLCDB find corresponding locale path. For example, if my current directory is D:\Mozilla\LC (Win) or /home/moz/lc (UNIX) and my locale is in full path of D:\Mozilla\LC\locale\en-US\global\... or /home/moz/lc/locale/en-US/global/..., then you have to use ROOT as locale/en-US.
ROOT æ¯å¥ï¼ROOT æ¯è® MozLCDB æ¾å°å°æ locale çè·¯å¾ãæ¯å¦èªªï¼å¦ææç®åçç®éæ¯ D:\Mozilla\LC (Win) æ /home/moz/lc (UNIX) èæçµå°è·¯å¾ç locale æ¯ D:\Mozilla\LC\locale\en-US\global\... æ /home/moz/lc/locale/en-US/global/...ï¼é£ä½ ç ROOT æè©²å°±æ¯ locale/en-USãby kourge
The procedure of 'Import'and Multiple Product 'å¯å ¥' æ¥é©åè·¨ç¢å
What really happened when you 'import'? MozLCDB will scan and walk through all files inside the 'prepared directory' assigned by ROOT. Currently, only *.dtd and *.properties will be processed. All other files will be ignored.
When one DTD or properties file was found, MozLCDB first reads its content for the 'key's and original locales. If a key was not found (never seen), it will be inserted into database as a 'new' entry. If a key was found, MozLCDB will determine what to do depending on the original (en-US) locale message. If it is exactly same as some version recorded in database, it is considered a 'same' entry with no new entries introduced. If no entries with same original could be found, MozLCDB will append one entry with timestamp into database. This is the magic to make multiple product possible. We keep all versions of original messages.
ç¶ 'å¯å
¥' ææç¼çä»éº¼äºï¼MozLCDB æææä¸éæ ¹æ ROOT è·¯å¾å°æç 'å·²å妥ç®é' ä¸çæææªæ¡ãç®ååªæ *.dtd å *.properties æ被èçãå
¶ä»çæªæ¡æ被忽ç¥ã
ç¶æ¾å°ä¸å DTD æ properties æªæï¼ MozLCDB æå
è®å裡é¢ç 'key'(è¯è¨»ï¼å¾é¢æéæ²çæ以ä¸ç¥ééæ¯å¥...= =) ååå§ Locale å
§å®¹ãå¦ææ¾ä¸å° key æ (å¾ä¾æ²çé)ï¼å°±æå¨è³æ庫ä¸æå
¥ä¸å 'æ°' æ¬ä½ãå¦ææ¾å° keyï¼MozLCDB ææ ¹æåå§ (en-US) ç Locale è¨æ¯æ±ºå®è¦åä»éº¼åä½ãå¦æèè³æ庫ä¸æçæ¬çç´éå®å
¨ç¸åï¼å°±ä¸æç¢ç 'æ°' çæ¬ä½èä½¿ç¨ 'å樣' çæ¬ä½ãå¦ææ¾ä¸å°ååå§å
§å®¹ç¸åçæ¬ä½ï¼MozLCDB æéå ä¸å帶ææéæ³è¨çæ¬ä½å°è³æ庫ä¸ãéå°±æ¯è½å¤ éå°è·¨ç¢ååè½çç¥å¥ä¹èãæåä¿çäºææçæ¬çåå§è¨æ¯ã
by Jose Sun
The procedure of 'Export' 'å¯åº'æ¥é©
What really happened when you 'export'? MozLCDB will scan and walk through all files inside the 'prepared directory' assigned by ROOT. Currently, only *.dtd and *.properties will be processed. All other files will be ignored.
When one DTD or properties file was found, MozLCDB first reads its content for the 'key's and original locales, then try to lookup database to decide what localized string to put in. If you export with '-x', MozLCDB assume you are working with a clean original copy exactly just what you have imported, so it will check for existence of keys and original locale message. However, you may want to export to a working (trial) copy. In that usage, -x will warn and stop because original message is filled with your localized strings. In this case you may use '-X' which will not check for keys.
Usage: Syntax Overview
Run 'mozlcdb.pl -h' to see its syntax: usage: mozlcdb.pl [-uUixXen] [PATH] ... [-u] : (default) update editing table (current.txt) to database -U [files...]: import/update from editing table -i ROOT: import files from ROOT(jar file or directory root) -x ROOT: extract and update files in ROOT. -X ROOT: extract and update files in ROOT, ignore errors. -e : generate latest version of full table from database -n ROOT1 ROOT2: init with ROOT1 as en while ROOT2 as tr [CARE] -c : check database -r aa-BB DispName: update "contents.rdf" locale entries from en-US to aa-BB with DispName
Usage: Import from MozillaTranslator
If you don't need to import from MozillaTranslator, skip this section. You must have python working before you start the procedure.
I know this is weird: why python, not perl? Because this python script is modified by another python script I wrote years ago and I'm too tired to make another perl version.
First, unzip your glossary.zip which is in same directory of MozillaTranslator. You will find a "glossary.txt". Then run mt2mldb.py which is included in the program archive in same directory. python mt2mldb.py
If no errors occurs, You will see a "mldb.out". Run the main program: perl mozlcdb.pl -U mldb.out
Usually you'll get some warnings about "Not sync". Don't worry about that.
If you have a "mozlcdb.txt" which is not 0 bytes in your directory now, congradulations, you have successfully imported MT glossary. Check mozlcdb.txt. Entries of chrome nodes should be look like "browser/metaData.dtd". If you see "locale/en-US/...." of "en-US/...", please use the replace feature of your editor to fix this error. This is caused by some different MozillaTranslator.
Usage: Import from an already localized language pack
If you have an already working language pack, say aa-BB, you must get its matching version of en-US package or importing may be useless.
Unzip your language pack jar files (both for aa-BB and en-US). If region directory is included as BB and US, move all stuff inside BB/ and US/ to aa-BB/ and en-US/ Move directories so that you can see en-US/ and aa-BB/ and your mozlcdb.pl in same directory. perl mozlcdb.pl -n en-US aa-BB
If it stopped and giving you errors, try to identify what file stopped it. Try to resolve on your own if you know perl (feedback welcome), or mail me. If you have a "mozlcdb.txt" which is not 0 bytes in your directory now, congradulations, you have successfully imported MT glossary.
Usage: Import from CVS directory
Remember to backup your glossary database (mozlcdb.txt) before you import because you can rollback if anything goes wrong. First, you must pull from CVS directory. I'm not going to explain details here. Check here. Now make sure what's your ROOT. Look at the previous section of 'Background Knowledge'. If you have CVS pulled as 'mozilla/toolkit/locales' and 'mozilla/browser/locales' in your current directory, please use ROOT as "mozilla/toolkit/locales/en-US/chrome mozilla/browser/locales/en-US/chrome". Run this command: perl mozlcdb.pl -i ROOT
Example:
perl mozlcdb.pl -i mozilla/toolkit/locales/en-US/chrome mozilla/browser/locales/en-US/chrome
You should see a 'current.txt' generated now.
Usage: Import from ZIP(JAR) language pack
Remember to backup your glossary database (mozlcdb.txt) before you import because you can rollback if anything goes wrong. Extract en-US.jar (and en-[win|unix|mac].jar, US.jar if you have them) to some place Now make sure what's your ROOT. Look at the previous section of 'Background Knowledge'. If you are working with Firefox 1.0PR, you'll see a directory named 'locale'. That's the ROOT. Run this command: perl mozlcdb.pl -i ROOT
Example:
perl mozlcdb.pl -i locale
You should see a 'current.txt' generated now. Usage: Working with input(editing) table The input(editing) table is named 'current.txt'. You should see it after you imported something (except importing from MozillaTranslator or already localized language pack). The format is very simple. Take this for example:
- comment [browser/aboutDialog.dtd] id=aboutVersion en=version tr=PUT YOUR LOCALIZED STRING HERE.
All lines stared with ';' are comments. [ ] marks the chrome node. i.e., the file path after ROOT. DO NOT CHANGE THIS. id= means the 'key' in file. DO NOT CHANGE THIS. en= Original en-US locale string. DO NOT CHANGE THIS. tr= Translated locale. This is really what you are going to work with.
P.S: Updated and newly found strings will be ";tr=" commented at first. Remeber to remove the ";" mark when you localized one. kp= Just like keep in MT. kp=1 will ignore tr= when exporting. cm= Comment. Similiar to 'localization note' in MT. Does nothing. Keep in mind that you should use UTF-8 file encoding.
Usage: Update database with an input table
When you finished editing, you have to update database. This is the default action if you give no arguments to MozLCDB. perl mozlcdb.pl (or) perl mozlcdb.pl -u
Usage: Export database to CVS
Before you export, you have to request for CVS account. Although you may already checked in your locale module, for example aa-BB, but we're not going to use it. Please review the section of 'Background Knowledge' for 'The procedure of Export'. You have to use the original dtd and properties files from en-US. Prepare a directory of original files. You may just copy from original en-US directory, like cp -R mozilla/toolkit/locales/en-US/chrome aa-BB-toolkit cp -R mozilla/browser/locales/en-US/chrome aa-BB-browser
The commands (UNIX only) above will generate ROOT of "aa-BB-toolkit aa-BB-browser".
If you use Windows, you can use Explorer to copy.
For me, I'd like to copy original files into aa-BB CVS directory: (the aa-BB is exactly the CVS directory of locale aa-BB in the example, and the commands are witten with bash. You have to modify it to fit your own environment.) find aa-BB -name "*.dtd" -delete; find aa-BB -name "*.properties" -delete; for X in `find en-US -name "*.dtd"` ; do cp $X ${X/en-US/aa-BB} ; cvs add ${X/en-US/aa-BB}; done Run the export command. perl mozlcdb.pl -x ROOT For example: perl mozlcdb.pl -x aa-BB-toolkit aa-BB-browser
After your first export, you may try (see the next subsection)the exported stuff. Then you can modify the input table and 'update' database again. And for the second time you want to 'export', things get easier. You don't have to prepare directory again. just use same ROOT and change -x to -X: perl mozlcdb.pl -X ROOT
Finally, after you get a stable version, pleas make sure you have all *.dtd and *.properties added into CVS. And CVS commit!
Usage: Export database to a standalone language pack, or JAR files
Before you start, there's something you have to know. Currently we don't have a really good method for changing locale in Firefox (maybe we will never do), and the bug of "using extensions without corresponding locale leads to crashing" is still there (maybe will be solved in 1.0 release), so trying to provide language packs for end user is really a mess. The better way is to export to CVS files and let mozilla.org build a official localized build. And if you want to make end user happy, due to the issues I mentioned above, here I described is kind of 'hacked' language pack. I'll export files, and make them with en-US chrome node path, and save to an 'en-US.jar' to replace the original en-US.jar.
This is NOT GOOD, but seems like making most end user happy. If you don't want to make such evil language packs, you have to go manually edit every *.rdf in directories, and prepare install.rdf or install.js.
OK... But if you are happy with evil packs, or you're just trying your newly localized stuff (this is mainly what I use this feature now for) , here's how to make it work:
Prepare a directory of original files. You may extract from en-US.jar, and mostly you will have a directory named 'locale'. Now identify your ROOT. In the case above, it is just 'locale'. Export with: perl mozlcdb.pl -x ROOT For example, perl mozlcdb.pl -x locale If you are building a jar with new locale instead of replacing en-US, use perl mozlcdb.perl -r aa-BB "Language Name" ROOT
which will update all the 'contents.rdf' in ROOT. However, using a new locale name will require a mechanism of locale switching.
Package your ROOT to a jar(ZIP) just like the layout of en-US.jar. For Windows, use your favorite archiver (WinRAR, or WinZIP, ... etc) For UNIX: zip -r0 en-US.jar locale
Now move the newly created jar to where your Firefox's en-US.jar is, replace it, and restart Firefox! You should be able to see your results, a localized Firefox now. After your first export, you may try the exported stuff. Then you can modify the input table and 'update' database again. And for the second time you want to 'export', things get easier. You don't have to prepare directory again. just use same ROOT and change -x to -X: perl mozlcdb.pl -X ROOT
If you want to create language pack or localized builds (again, this is NOT EASY and NOT SUGGESTED if you want to release files in this way. You should use CVS and let mozilla.org do this work. Care.... files made in this way cannot be called 'Official' due to new L10N policy), please see Creating a Localized Installera and Localizing Firefox . An easy hack is just to put the new en-US.jar into a Firefox installer, anyway.
Usage: Things left
Some commands are not explained in previous sections.
-e can export whole keys in a database (used if your input table is broken). -U can update database with editing tables with less checking. -c can check database with some rules to help you find buggy phrases like a typo of %s and %S or " " without the trailing ';'.
Usage: Tips
This program is still under development. Please backup your database (mozlcdb.txt) before doing any big changes, like -U or -i. Each time you have imported something, the 'current.txt' will be overwritten by a new one. So before you do an import, make a copy of last edited 'current.txt'. If you find any file with all-new locales (the information was displayed when you import/...etc), try to take a look at it. Maybe it's file just being renamed/moved. You may edit database to change/duplicate a copy of that to avoid doing all stuff again. A smarter rule of guessing new values is on plan.
Epilogue
This program is still under development. I used it sucessfully to make a working language pack (well, the en-US.jar) for Mozilla Firefox 1.0PR, Traditional Chinese. I'm not sure whether it is easy enough for most people or not, but it is designed for all what I need. So here I present it to all who needs to localize new Mozilla products but could not find any working tools to go on.
If you have any suggestions/problems, feel free to contact me. You can also use mozilla-l10n mailing list.
Copyright çæ¬å®£å
MozLCDB is licensed under MPL 1.1 . This program and document is made by Hung-Te Lin. Allrights reserved.
MozLCDBæ¯ææ¬æ¼MPL 1.1ãéåç¨å¼åæ件æ¯ç±æå¼å¾·è£½ä½çãçæ¬ææ ä¸å¾è½è¼ byTszkin
‧返回上一頁: éç¼äººå¡æ件主é