舊文件

此處文件僅供參考,請自行考量時效性與適用程度,其他庫藏文件請參考文件頁面
我們亟需您的協助,進行共筆系統搬移、及文件整理工作,詳情請查閱參與我們

「MozLCDB Manual」修訂間的差異

出自 MozTW Wiki

行 42: 行 42:
 
<br>
 
<br>
 
MozLCDB 主要用於 Mozilla 本地化。相比 MozillaTranslator 來說,你會注意到:
 
MozLCDB 主要用於 Mozilla 本地化。相比 MozillaTranslator 來說,你會注意到:
* MozLCDB只是一個使用 command line perl script,沒有 GUI。<br>
+
* MozLCDB 是只有命令列模式(Command Line)Perl Script,沒有 GUI。<br>
你可以使用編輯器修改所需的。
+
你可以(而且也必須)使用任何你想使用的編輯器來修改所有東西。
* 針對多個產品維護。<br>
+
* 可以針對多個產品維護。<br>
即是說,當你本地化 Mozilla,Firefox,Thunderbird,Netscape 並遇到相同 chrome node 時,只需使用同一個實體。
+
也就是說,你可以本地化 Mozilla, Firefox, Thunderbird, Netscape 而只需使用一個相同 Chrome 節點的實體。
* 能於 CVS ZIP 語言包下工作
+
* 能與一起 CVS 協同工作及下載 ZIP 語言套件
* 儲存 database 的格式為人類可讀,可寫。
+
* 儲存的資料庫格式更可讓人類讀寫。
* 每個 database 檔只支援一個 locale。不支援多個 locale (MT可以)。<br>
+
* 每個資料庫檔只支援一個 Locale。不支援多 Locale (MT 可以)。<br>
假如你需要製作多個 locale,你要使用多個 database 檔。
+
假如你需要製作多個 Locale,你要使用多個資料庫檔案。
 
* 假如你了解 Perl 語言,這支程式可是相當容易修改。
 
* 假如你了解 Perl 語言,這支程式可是相當容易修改。
 
by a guest on the forums
 
by a guest on the forums
行 56: 行 56:
 
你需要下面這些東西:
 
你需要下面這些東西:
  
    * Perl 5.8 或以上版本
+
*Perl 5.8 或以上版本
    * 你所偏好的編輯器 (要有能力開啟及儲存 UTF-8,比如我選擇的是 VIM)
+
*你所偏好的編輯器 (要有能力開啟及儲存 UTF-8,比如我選擇的是 VIM)
    * (選用) 如果你要使用 ZIP 或是 JAR 語言套件或是你想匯入 MozillaTralsator 的詞庫,需要任一種類的 ZIP 壓縮程式
+
*(選用) 如果你要使用 ZIP 或是 JAR 語言套件或是你想匯入 MozillaTralsator 的詞庫,需要任一種類的 ZIP 壓縮程式
    * (選用) 如果你想要匯入 MozillaTralsator 的詞庫,你需要 Python 2.0+
+
*(選用) 如果你想要匯入 MozillaTralsator 的詞庫,你需要 Python 2.0+
    * (選用) Perl 的相關知識,這樣你遇到問題才可以自行解決或是修改它
+
*(選用) Perl 的相關知識,這樣你遇到問題才可以自行解決或是修改它
  
 
by [[User:Josesun|Jose Sun]]
 
by [[User:Josesun|Jose Sun]]
行 66: 行 66:
 
取得這些檔案:
 
取得這些檔案:
  
    * 最新版本: 2004 年 8 月 2 日,星期六 11:00:43 CST  (hack on your own!)
+
*最新版本: 2004 年 8 月 2 日,星期六 11:00:43 CST  (hack on your own!)
    * 釋出版本:
+
*釋出版本:
          o 版本 0.2 (穩定版本,FF1.0/TB0.8 測試通過)
+
**版本 0.2 (穩定版本,FF1.0/TB0.8 測試通過)
          o 版本 0.1 (有點小錯誤)
+
**版本 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.
+
這一節會解釋 MozLCDB 的基本想法。雖然你使用它的時候不需要任何底下說的知識,但是可以幫助你更了解它。是的,如果你趕時間的話可以直接到 "用法:" 這一節。但是無論如何我都強烈建議你在開始之前先把這些知識弄清楚。
  
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.
+
我試著在這裡解釋 MozLCDB 的工作流程。不用擔心那些標記起來的術語,接下來的小節都會一一解釋。
  
      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 會從 '已備妥目錄' (可以從 CVS ZIP 語言套件取得)試著 '匯入' 資料,然後儲存並合併到 '(詞彙) 資料庫'。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.  
 
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.  

於 2005年1月28日 (五) 04:01 的修訂

由於有人在討論區上提議要把 piaip 的 MozLCDB 文件翻成中文,所以把大家翻的放到這邊。
該文件原文位於 http://moztw.org/tools/mozlcdb/
另外,請大家翻譯時,使用全形的標點符號(如 "," 和 "。" 而非 "," 或 ".")
也請在中英文之間空一格。

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 架構經常改變,除了 MT 外,需要下更多額外的功夫。


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' 由其他人已經使用了。Hmmm...。可能MLD?我並不是 perl 高手因此這個並不是完善亦不典雅的現在,但是它幫助我引起一個沒有付出許很多努力運作的地方 - Firefox 1.0PR (比喻為 MozillaTranslator 戰爭) 。 by tszkin

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 系統需求

你需要下面這些東西:

  • Perl 5.8 或以上版本
  • 你所偏好的編輯器 (要有能力開啟及儲存 UTF-8,比如我選擇的是 VIM)
  • (選用) 如果你要使用 ZIP 或是 JAR 語言套件或是你想匯入 MozillaTralsator 的詞庫,需要任一種類的 ZIP 壓縮程式
  • (選用) 如果你想要匯入 MozillaTralsator 的詞庫,你需要 Python 2.0+
  • (選用) Perl 的相關知識,這樣你遇到問題才可以自行解決或是修改它

by Jose Sun

Download 下載

取得這些檔案:

  • 最新版本: 2004 年 8 月 2 日,星期六 11:00:43 CST (hack on your own!)
  • 釋出版本:
    • 版本 0.2 (穩定版本,FF1.0/TB0.8 測試通過)
    • 版本 0.1 (有點小錯誤)

by Jose Sun

Background Knowledge 背景知識

這一節會解釋 MozLCDB 的基本想法。雖然你使用它的時候不需要任何底下說的知識,但是可以幫助你更了解它。是的,如果你趕時間的話可以直接到 "用法:" 這一節。但是無論如何我都強烈建議你在開始之前先把這些知識弄清楚。

Workflow 工作流程

我試著在這裡解釋 MozLCDB 的工作流程。不用擔心那些標記起來的術語,接下來的小節都會一一解釋。

基本上,MozLCDB 以這種方法運作:MozLCDB 會從 '已備妥目錄' (可以從 CVS 或 ZIP 語言套件取得)試著 '匯入' 資料,然後儲存並合併到 '(詞彙) 資料庫'。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. 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. 

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.

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.)

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. 

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. 

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.
個人工具