Framework Tsung 2010 / 08 / 14 - - PowerPoint PPT Presentation

framework
SMART_READER_LITE
LIVE PREVIEW

Framework Tsung 2010 / 08 / 14 - - PowerPoint PPT Presentation

Framework Tsung 2010 / 08 / 14 tsunghao@gmail.com CC Who am I SiteTag I can do .... Why 15 :


slide-1
SLIDE 1

不用 Framework 一天完成網站的 多國語系製作

Tsung 2010 / 08 / 14 tsunghao@gmail.com

slide-2
SLIDE 2

本投影片 採用 CC 授權

slide-3
SLIDE 3

Who am I

slide-4
SLIDE 4

SiteTag

slide-5
SLIDE 5

I can do ....

slide-6
SLIDE 6

Why 多國語系

slide-7
SLIDE 7

中國 15 億人

slide-8
SLIDE 8

前進

世界

slide-9
SLIDE 9 取自 : http://www.vagabondjourney.com/travelogue/study-spanish-rosetta-stone/
slide-10
SLIDE 10

問 題

slide-11
SLIDE 11

流程彈性

slide-12
SLIDE 12

名詞統一

slide-13
SLIDE 13

製作時間

slide-14
SLIDE 14

流程彈性 名詞統一 製作時間

slide-15
SLIDE 15

彈性 +++

slide-16
SLIDE 16

cp -r tw/ en/

slide-17
SLIDE 17 網址 : http://www.foxconn.com.tw/
slide-18
SLIDE 18 網址 : http://www.foxconn.com.tw/GroupProfile.htm
slide-19
SLIDE 19

不用 Framwork 一天完成網站的 多國語系製作

slide-20
SLIDE 20

不用 Framwork

slide-21
SLIDE 21

symfony

symfony | Chapter 13 - I18n And L10n

$product = ProductPeer::retrieveByPk(1); $product->setCulture('fr'); $product->setName('Nom du produit'); $product->save(); $product->setCulture('en'); $product->setName('Product name'); $product->save(); echo $product->getName(); => 'Product name' $product->setCulture('fr'); echo $product->getName(); => 'Nom du produit'
slide-22
SLIDE 22

Yii

Yii - Internationalization (I18N)

Yii:t() Yii::t('app', 'Path alias "{alias}" is redefined.', array('{alias}'=>$alias)) Yii::t('Xyz.categoryName', 'message to be translated') protected/messages/LocaleID/CategoryName.php
slide-23
SLIDE 23

CodeIgniter

CodeIgniter | Internationalization Views i18n

http://www.example.com/it/...
  • 1. view_name_it.php
  • 2. view_name.php
http://www.example.com/fr/...
  • 1. view_name_fr.php
  • 2. view_name.php
slide-24
SLIDE 24

CakePHP

CakePHP :: Internationalizing Your Application

Gettext, 使用 __() /app/locale/<locale>/LC_MESSAGES/<domain>.po /app/locale/eng/LC_MESSAGES/default.po (English) /app/locale/fre/LC_MESSAGES/default.po (French) /app/locale/por/LC_MESSAGES/default.po (Portuguese)
slide-25
SLIDE 25

如何做 多國語系

slide-26
SLIDE 26 網址 : http://golangd.com/
slide-27
SLIDE 27 Source: phpBB3
slide-28
SLIDE 28 Source: discuz
slide-29
SLIDE 29

文字 抽離

slide-30
SLIDE 30

檔案 區別

slide-31
SLIDE 31

名詞統一 變數命名

slide-32
SLIDE 32

不用 Framwork 一天完成網站的 多國語系製作

slide-33
SLIDE 33

Gettext

slide-34
SLIDE 34

1994 July

slide-35
SLIDE 35
  • 1994 年 7

月 開始構想

  • 1995 年 4

月 正式發布

  • 1997

年 加入 textdomain, bindtextdomain

  • 2000

年 加入 UTF-8 ... 等支援 History of GNU gettext

slide-36
SLIDE 36

支援

C, C++, Objective C, sh, bash, Python, Common Lisp, clisp C, Emacs Lisp, librep, Scheme, Smalltalk, Java, C#, gawk, Pascal, wxWidgets, YCP, Tcl, Perl, PHP, Pike, GCC-source, ruby, javascript

詳見 : List of Programming Languages - GNU `gettext' utilities
slide-37
SLIDE 37

_()

slide-38
SLIDE 38

_('hello')

slide-39
SLIDE 39

<?php

echo _('hello, world');

?> 嗨 , 世界

slide-40
SLIDE 40

Gettext

套件 & 使用

slide-41
SLIDE 41

xgettext

  • extract gettext strings from source

msgfmt

  • compile message catalog to binary format

apt-get install gettext

slide-42
SLIDE 42

po

mo

  • 機器
slide-43
SLIDE 43

mo

+

系統環境

slide-44
SLIDE 44

環境設定

slide-45
SLIDE 45

Locales

en_US UTF-8 zh_CN UTF-8 zh_TW UTF-8

slide-46
SLIDE 46

語系路徑

mkdir -p locale/zh_TW/LC_MESSAGES mkdir -p locale/zh_CN/LC_MESSAGES mkdir -p locale/en_US/LC_MESSAGES

slide-47
SLIDE 47

程式設定

define('PACKAGE', 'hello'); putenv('LANG=zh_TW'); setlocale(LC_ALL, 'zh_TW'); bindtextdomain(PACKAGE, 'locale'); textdomain(PACKAGE);

slide-48
SLIDE 48

流程

xgettext –from-code=UTF-8 -d hello hello.php vim hello.po # 翻譯 msgfmt -o locale/zh_TW/LC_MESSAGES/hello.mo hello.po

slide-49
SLIDE 49

Demo

slide-50
SLIDE 50

JavaScript 多國語系

slide-51
SLIDE 51

Po 編輯器

slide-52
SLIDE 52

不用 Framwork 3 分鐘完成網站 多國語系製作

slide-53
SLIDE 53

3 分鐘

slide-54
SLIDE 54

流程彈性 名詞統一 製作時間

slide-55
SLIDE 55 http://translate.google.com/translate_tools
slide-56
SLIDE 56 http://www.microsofttranslator.com/widget/
slide-57
SLIDE 57

FAQ

slide-58
SLIDE 58

聯絡資料

Tsung tsunghao@gmail.com http://plog.longwin.com.tw