Copyright © 2010-2020 Marc Worrell, Arthur Clemens
Authors: Marc Worrell (marc@worrell.nl).
event/2 | Set the current session (and user) language, reload the user agent's page. |
generate/1 | Generate all .po templates for the given site. |
generate_core/0 | Generate consolidated translation file zotonic.pot for all core modules. |
init/1 | Make sure that we have the i18n.language_list setting when the site starts up. |
language_add/3 | Add a language to the i18n configuration. |
language_delete/2 | Remove a language from the i18n configuration. |
language_status/3 | Set/reset the is_enabled flag of a language. |
observe_admin_menu/3 | |
observe_dispatch_rewrite/3 | Grabs the language from the path parts and sets it as the page language (if that language is enabled). |
observe_request_context/3 | Check if the user has a preferred language (in the user's config). |
observe_scomp_script_render/2 | |
observe_set_user_language/3 | |
observe_url_rewrite/3 | |
observe_user_context/3 | |
set_default_language/2 | Set the default language. |
set_language/2 | Set the language of the context. |
set_language_url_rewrite/2 | Set/reset the state of the 'rewrite URL' setting. |
set_user_language/2 | Set the language, as selected by the user. |
url_strip_language/1 | Strip the language code from the location (if the language code is recognized). |
valid_config_language/2 | Returns a valid language from the config language. |
event(Postback, Context) -> any()
Set the current session (and user) language, reload the user agent's page. Called from language switch. Reloads the page to reflect the new setting.
generate(Host) -> any()
Generate all .po templates for the given site
generate_core() -> ok | {error, needs_core_zotonic}
Generate consolidated translation file zotonic.pot for all core modules. Both active and inactive modules are indexed, so the generated translation files are always complete.
init(Context) -> any()
Make sure that we have the i18n.language_list setting when the site starts up.
language_add(NewLanguageCode::atom() | binary(), IsEnabled::boolean(), Context::z:context()) -> ok | {error, not_a_language}
Add a language to the i18n configuration
language_delete(LanguageCode::atom(), Context::z:context()) -> z:context()
Remove a language from the i18n configuration
language_status(Code::atom(), Status::boolean() | editable, Context::z:context()) -> ok | {error, nolang | default}
Set/reset the is_enabled flag of a language.
observe_admin_menu(Admin_menu, Acc, Context) -> any()
observe_dispatch_rewrite(Dispatch_rewrite, Dispatch, Context) -> any()
Grabs the language from the path parts and sets it as the page language (if that language is enabled). Note that this works irrespectively of the rewrite_url setting: when rewrite_url is false and the URL includes the language, we will still read the language instead of returning a 404. For handling 'id' (which can either mean /id/PageId or the language Indonesian): if id is followed by a number, do not use it as language.
observe_request_context(Request_context, Context, X3) -> any()
Check if the user has a preferred language (in the user's config). If not then check the accept-language header (if any) against the available languages.
observe_scomp_script_render(Scomp_script_render, Context) -> any()
observe_set_user_language(Set_user_language, Context, X3) -> any()
observe_url_rewrite(Url_rewrite, Url, Context) -> any()
observe_user_context(User_context, Context, X3) -> any()
set_default_language(Code::atom(), Context::z:context()) -> z:context()
Set the default language.
set_language(Code0::atom() | binary() | string(), Context::z:context()) -> z:context()
Set the language of the context. Sets to the given language if the language exists in the config language and is enabled; otherwise tries the language's fallback language; if this fails too, sets language to the site's default language.
set_language_url_rewrite(Value::boolean(), Context::z:context()) -> z:context()
Set/reset the state of the 'rewrite URL' setting.
set_user_language(Code::atom(), Context::z:context()) -> z:context()
Set the language, as selected by the user. Persist this choice.
url_strip_language(Url::binary()) -> binary()
Strip the language code from the location (if the language code is recognized).
For instance: <<"/nl-nl/admin/translation">>
becomes <<"/admin/translation">>
valid_config_language(Code::atom() | undefined, Context::z:context()) -> z_language:language_code() | undefined
Returns a valid language from the config language. If the language is not available or not enabled, tries the language's fallback language (retrieve from z_language); if this fails too, returns the data for the site's default language.
Generated by EDoc