Gallery: 语言设定:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
 
(未显示同一用户的4个中间版本)
第1行: 第1行:
= Language Settings in Gallery 2 =
= Gallery2中的语言设定 =
The preferred language can be set per session, per user, as a site default and you can change it also with a override with a request parameter.
偏好语言可以按会话,用户或作为网站默认来进行设定。你也可以使用一个请求参量进行覆盖从而改变语言设定。


'''NOTE:''' This article describes the behavior in '''Gallery 2.1'''. Gallery 2.0/2.0.1/2.0.2 have a slightly different behavior (e.g. set the default language to ''None'' if you want the browser language preference check in Gallery 2.0).
'''注:''' 此文描述'''Gallery 2.1'''中的行为。而Gallery 2.0/2.0.1/2.0.2在行为上略有不同(举例,如果你希望Gallery2.0执行浏览器语言偏好检查的话,就将默认语言设定为''None(无)'')。


== Priority - Which setting is valid when? ==  
== 优先级 – 何种设定何时有效? ==  
This should be the priority, meaning that 1. will override 2-6 and 4 will override 5, 6 if 1-3 is not set, etc.
以下所列就是所谓的优先级,意思是1. 会覆盖2-6;如果3没有设定,4会覆盖5, 6等。


# g2_language=languageCode in request string
# 请求字串中g2_language=languageCode  
# activeLanguage from embedding application (only applicable to Embedded G2)
# 来自嵌入应用程序的activeLanguage(仅适用于嵌入的G2)
# Active language of the current session
# 当前对话的活动语言
# Preferred language of the current user
# 当前用户的偏好语言
# (Optional) Preferred language specified by the browser of the user
# (可选)浏览器用户定义的偏好语言
# Site wide default language for G2
# G2的站内默认语言


Usually, you don't use g2_language overrides in URLs. And new visitors of your website don't have an active language yet and they they are not logged in as user yet. Thus, Gallery 2 will default to the preferred language specified in ''site admin''.
一般说来,在URL中不使用g2_language 覆盖。网站的新到访者没有一个活动的语言,并且没有作为用户登录到网站中。因此Gallery2将语言默认设置为''站点管理(site admin)''中定义的偏好语言。


If you enable the browser language preference check in ''site admin'', it will use the language specified by the browser of the visitors. And if the language preference specified by the browser is not available in your Gallery installation, it will default to Gallery default language (the one defined in ''site admin'').
如果你在''站点管理(site admin)''中启用了浏览器语言偏好检查的话,那么它就会使用访问者浏览器所定义的语言。而如果访问者浏览器所定义的语言在你的Gallery2中不可用的话,那么就会默认设置为Gallery的缺省语言(即''站点管理(site admin)''中所定义的)。


=== What does "Preferred Language" mean? ===
=== "偏好语言"是什么意思? ===
If the Gallery 2 translation for a specific language is 100% complete (that is, if all strings in Gallery 2 have been translated in this language), the complete Gallery 2 experience will be translated into this language if this language is chosen.
如果Gallery2的某个语言版本翻译度达100%(即Gallery2中所有的字串都翻译为该语言了)的话,那么Gallery2全盘都会以你所选择的语言呈现出来,并为你所使用。


If a translation is not 100% complete, all non-translated strings can't be translated and you will see a mix of English and your preferred language.
如果翻译度没有达到100%,所有未被翻译的字串就无法以你的语言显示出来,那么你就会看到英语和你的语言夹杂在一起。


== Overview over the 6 Language Settings ==  
== 六种语言设定概览 ==  




=== Site wide default language for G2 ===
=== G2站点范围的默认语言 ===
You can set the site wide default language for G2 in ''site admin'' -> ''General''. See [[#Requirements|Requirements]].
你可以在''site admin'' -> ''General''中为G2设定站点范围的默认语言。参见[[#Requirements|要求]]
It will be used for all users, unless you enable the browser language preference check. If so, it will use this default as fallback if the browser preference is not available.
这将对所有用户适用,除非你启用了浏览器语言偏好检查。如果是这样的话,在浏览器偏好不可用的情况下,它就会将此默认语言作为最低限度的可用语言。


This default can always be overriden in the user preferences of each user and also with the language selector block if you choose to show the block.
此设定可被任何用户的用户偏好以及语言选择器模块(如果你选择显示此模块的话)所覆盖。


=== Preferred language of the current user ===
=== 当前用户的偏好语言 ===
Each user can set the preferred language in ''Your settings''. This overrides the site wide default language.
每个用户都可以在''你的设定(Your settings)''中设定所偏好的语言。这个将会覆盖站点范围默认语言的设定。


=== Active language of the current session ===
=== 当前对话的活动语言 ===
After visiting the first page of your G2, G2 stores some data for this visitor, to keep track of the user's preferences etc.
访问G2的第一个页面后,G2将会存储该访问者的一些数据,并追踪此用户的偏好等。
It also stores the preferred language for this user.
另外它也存储该用户所偏好的语言。


All users, including anonymous visitors (guests) can choose their preferred language in G2 if you add the ''language selector'' block to the sidebar. You can dot that in ''site admin'' -> ''Themes'' -> ''Matrix'' (or whatever your active theme name is).
如果你在边栏添加了''语言选择器(language selector)''区块的话,那么所有用户,包括匿名用户(游客),都可以在G2中选择他们所偏好的语言。此操作可以在''site admin'' -> ''Themes'' -> ''Matrix''(这是默认外观主题的名称,你的外观主题会根据你的设定有所不同)中达成。


The active language of the current session overrides a user's preferred language and the site wide default language.
当前对话的活动语言会覆盖用户的偏好语言和站点范围的默认语言。


=== Preferred language specified by the browser ===
=== 浏览器定义的偏好语言 ===
Browsers like Internet Explorer, Firefox, Opera, and pretty much every other browser give the webserver a hint what language the user might expect. Usually, if you use MS Windows in your language rather than in English, then Internet Explorer will also include the language code for your language in all requests to Gallery 2. Similarely, if you downloaded Firefox for your language, then it will tell Gallery 2 that you expect websites in this language. If you're using Firefox in English but would rather prefer another language, you can change this in the Firefox options.
如IE,火狐,Opera一类的浏览器会给WEB服务器一个提示,即用户可能期望使用的语言。一般来说,如果你使用非英文版的微软Windows的话,那么IE浏览器就会在Gallery2的所有请求中包含你所使用的语言的语言代码。相似的是,如果下载某语言版本的火狐浏览器,它就会告知Gallery2你希望网站中使用该语言。如果你使用英文版的火狐浏览器但偏好使用另一种语言的话,你可以在火狐浏览器的选项中进行修改。


If the browser language preference check is enabled in ''site admin'', Gallery 2 will detect this preferred language as specified by the browser (the HTTP_ACCEPT_LANGUAGE header). If any language listed in HTTP_ACCEPT_LANGUAGE is available in Gallery 2, it will use it. Else, it will fall back to the Gallery 2 default language.
如果在''站点管理(site admin)''中启用了语言偏好检查的话,Gallery2会检测此浏览器定义的偏好语言(HTTP_ACCEPT_LANGUAGE header)。如果HTTP_ACCEPT_LANGUAGE中所列语言于Gallery2可用的话,就会使用。否则的话,它就会恢复为Gallery2的默认语言。


=== activeLanguage from GalleryEmbed::init() (Embedded G2) ===
=== 来自GalleryEmbed::init()的activeLanguage(嵌入的G2) ===
If Gallery 2 is embedded in another application through the GalleryEmbed API, then the embedding application can specify the active language for the current user/session in the call to G2. This language setting will set the session language in G2.
如果Gallery2通过GalleryEmbed API被嵌入到另一个应用程序中的话,那么嵌入程序就可以定义G2呼叫中当前用户/对话的活动语言了。此语言设定将设置G2中的对话语言。


=== g2_language=languageCode in request string ===  
=== 请求字串中的g2_language=languageCode ===  
If you want to add links to your G2 that already default to different languages, you can add the g2_language=languageCode parameter to the link. E.g. on your entry page, you could have a French flag linking to your Gallery 2 with main.php?g2_language=fr and a British/American flag which uses the link main.php?g2_language=en .
如果你想为默认多个语言的G2添加链接,可以为链接添加g2_language=languageCode 参量。比如,在入口页面上,你可以使用main.php?g2_language=fr显示一个法国国旗,或者是 main.php?g2_language=en则显示一个英国/美国国旗。


This will override any other language preference.
这将覆盖其他所有的语言偏好。


== Requirements ==  
== 要求 ==  
* Your PHP needs to have gettext support built-in and loaded.
* 你的PHP应有gettext支持进行内置并装载。
* Your system/server must have the locales (=~ translations into your languages) installed. See: [[Gallery:FAQ#I_changed_the_language_but_nothing_happens.2C_what.27s_wrong.3F|FAQ: I changed the language but nothing happens, what's wrong?]]
* 你的系统/服务器应安装本地语言(=~ 你所使用语言的翻译)。参见:[[Gallery:常见问题#我修改了语言但是没有效果,这是怎么回事? |常见问题:我修改了语言但是没有效果。怎么回事?]]
* You do not need the [[Gallery:Modules:multilang|multilang module]]. The multilanguage module can be used to translate the content, your album and image titles, descriptions etc. The built-in G2 translation translates the menus, the user interface, the welcome / confirmation emails, but G2 can't translate the titles that you entered without the multilanguage module.
* 你不需要[[Gallery:Modules:multilang|multilang模块]]。multilanguage模块可用来翻译内容,相册和图片标题及描述等。内置的G2翻译功能翻译菜单,用户界面,欢迎/确认邮件。但没有multilanguage模块的情况下,G2无法翻译你所输入的标题。


== TODO ==
== 所需做的 ==
* Downloadable Language Packs / Define in Site admin which languages should be available to the users
* 可下载语言包/在站点管理中定义用何种语言显示给用户


[[Category:Gallery 2:Usage]]
[[Category:Gallery 2:Usage]]
[[Category:Gallery 2:Configuration]]
[[Category:Gallery 2:Configuration]]

2008年9月17日 (三) 14:27的最新版本

Gallery2中的语言设定[ ]

偏好语言可以按会话,用户或作为网站默认来进行设定。你也可以使用一个请求参量进行覆盖从而改变语言设定。

注: 此文描述Gallery 2.1中的行为。而Gallery 2.0/2.0.1/2.0.2在行为上略有不同(举例,如果你希望Gallery2.0执行浏览器语言偏好检查的话,就将默认语言设定为None(无))。

优先级 – 何种设定何时有效?[ ]

以下所列就是所谓的优先级,意思是1. 会覆盖2-6;如果3没有设定,4会覆盖5, 6等。

  1. 请求字串中g2_language=languageCode
  2. 来自嵌入应用程序的activeLanguage(仅适用于嵌入的G2)
  3. 当前对话的活动语言
  4. 当前用户的偏好语言
  5. (可选)浏览器用户定义的偏好语言
  6. G2的站内默认语言

一般说来,在URL中不使用g2_language 覆盖。网站的新到访者没有一个活动的语言,并且没有作为用户登录到网站中。因此Gallery2将语言默认设置为站点管理(site admin)中定义的偏好语言。

如果你在站点管理(site admin)中启用了浏览器语言偏好检查的话,那么它就会使用访问者浏览器所定义的语言。而如果访问者浏览器所定义的语言在你的Gallery2中不可用的话,那么就会默认设置为Gallery的缺省语言(即站点管理(site admin)中所定义的)。

"偏好语言"是什么意思?[ ]

如果Gallery2的某个语言版本翻译度达100%(即Gallery2中所有的字串都翻译为该语言了)的话,那么Gallery2全盘都会以你所选择的语言呈现出来,并为你所使用。

如果翻译度没有达到100%,所有未被翻译的字串就无法以你的语言显示出来,那么你就会看到英语和你的语言夹杂在一起。

六种语言设定概览[ ]

G2站点范围的默认语言[ ]

你可以在site admin -> General中为G2设定站点范围的默认语言。参见要求。 这将对所有用户适用,除非你启用了浏览器语言偏好检查。如果是这样的话,在浏览器偏好不可用的情况下,它就会将此默认语言作为最低限度的可用语言。

此设定可被任何用户的用户偏好以及语言选择器模块(如果你选择显示此模块的话)所覆盖。

当前用户的偏好语言[ ]

每个用户都可以在你的设定(Your settings)中设定所偏好的语言。这个将会覆盖站点范围默认语言的设定。

当前对话的活动语言[ ]

访问G2的第一个页面后,G2将会存储该访问者的一些数据,并追踪此用户的偏好等。 另外它也存储该用户所偏好的语言。

如果你在边栏添加了语言选择器(language selector)区块的话,那么所有用户,包括匿名用户(游客),都可以在G2中选择他们所偏好的语言。此操作可以在site admin -> Themes -> Matrix(这是默认外观主题的名称,你的外观主题会根据你的设定有所不同)中达成。

当前对话的活动语言会覆盖用户的偏好语言和站点范围的默认语言。

浏览器定义的偏好语言[ ]

如IE,火狐,Opera一类的浏览器会给WEB服务器一个提示,即用户可能期望使用的语言。一般来说,如果你使用非英文版的微软Windows的话,那么IE浏览器就会在Gallery2的所有请求中包含你所使用的语言的语言代码。相似的是,如果下载某语言版本的火狐浏览器,它就会告知Gallery2你希望网站中使用该语言。如果你使用英文版的火狐浏览器但偏好使用另一种语言的话,你可以在火狐浏览器的选项中进行修改。

如果在站点管理(site admin)中启用了语言偏好检查的话,Gallery2会检测此浏览器定义的偏好语言(HTTP_ACCEPT_LANGUAGE header)。如果HTTP_ACCEPT_LANGUAGE中所列语言于Gallery2可用的话,就会使用。否则的话,它就会恢复为Gallery2的默认语言。

来自GalleryEmbed::init()的activeLanguage(嵌入的G2)[ ]

如果Gallery2通过GalleryEmbed API被嵌入到另一个应用程序中的话,那么嵌入程序就可以定义G2呼叫中当前用户/对话的活动语言了。此语言设定将设置G2中的对话语言。

请求字串中的g2_language=languageCode[ ]

如果你想为默认多个语言的G2添加链接,可以为链接添加g2_language=languageCode 参量。比如,在入口页面上,你可以使用main.php?g2_language=fr显示一个法国国旗,或者是 main.php?g2_language=en则显示一个英国/美国国旗。

这将覆盖其他所有的语言偏好。

要求[ ]

  • 你的PHP应有gettext支持进行内置并装载。
  • 你的系统/服务器应安装本地语言(=~ 你所使用语言的翻译)。参见:常见问题:我修改了语言但是没有效果。怎么回事?
  • 你不需要multilang模块。multilanguage模块可用来翻译内容,相册和图片标题及描述等。内置的G2翻译功能翻译菜单,用户界面,欢迎/确认邮件。但没有multilanguage模块的情况下,G2无法翻译你所输入的标题。

所需做的[ ]

  • 可下载语言包/在站点管理中定义用何种语言显示给用户