Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some docs updates.

  • Loading branch information...
commit 68ce483bc38f704527489a0d075a3695444b96a1 1 parent 9f5e694
@seriyps seriyps authored kaos committed
Showing with 18 additions and 21 deletions.
  1. +16 −20 README.markdown
  2. +2 −1  README_I18N
View
36 README.markdown
@@ -99,18 +99,14 @@ Options is a proplist possibly containing:
* `force_recompile` - Recompile the module even if the source's
checksum has not changed. Useful for debugging.
-* `locale` - The locale used for template compile. Requires
- erlang_gettext. It will ask gettext_server for the string value on
- the provided locale. For example, adding {locale, "en_US"} will
- call {key2str, Key, "en_US"} for all string marked as trans (`{%
- trans "StringValue" %}` on templates). See README_I18N.
+* `locale` - DEPRECATED. The same as {blocktrans_locales, [Val]}.
* `blocktrans_fun` - A two-argument fun to use for translating
- `blocktrans` blocks at compile-time. This will be called once for each pair of
- `blocktrans` block and locale specified in `blocktrans_locales`. The
- fun should take the form:
+ `blocktrans` blocks, `trans` tags and `_(..)` expressions. This will
+ be called once for each pair of translated element and locale
+ specified in `blocktrans_locales`. The fun should take the form:
- Fun(Block::string(), Locale::string()) -> <<"ErlyDTL code">> | default
+ Fun(Block::string(), Locale::string()) -> <<"ErlyDTL code">>::binary() | default
* `blocktrans_locales` - A list of locales to be passed to
`blocktrans_fun`. Defaults to [].
@@ -208,15 +204,15 @@ Same as `render/1`, but with the following options:
```erlang
my_compiled_template:translatable_strings() -> [String]
```
-List of strings appearing in `{% trans %}` tags that can be
-overridden with a dictionary passed to `render/2`.
+
+List of strings appearing in `{% trans %}` and `_(..)` tags.
my_compiled_template:translated_blocks() -> [String]
List of strings appearing in `{% blocktrans %}...{% endblocktrans %}`
blocks; the translations (which can contain ErlyDTL code) are
-hard-coded into the module and appear at render-time. To get a list
-of translatable blocks before compile-time, use the provided
+hard-coded into the module and appear at render-time. To get a list of
+translatable blocks before compile-time, use the provided
`blocktrans_extractor` module.
my_compiled_template:source() -> {FileName, CheckSum}
@@ -225,15 +221,15 @@ Name and checksum of the original template file.
my_compiled_template:dependencies() -> [{FileName, CheckSum}]
-List of names/checksums of templates included by the original
- template file. Useful for frameworks that recompile a template only
- when the template's dependencies change.
+List of names/checksums of templates included by the original template
+file. Useful for frameworks that recompile a template only when the
+template's dependencies change.
- my_compiled_template:variables() -> [Variable::atom()]
+ my_compiled_template:variables() -> [Variable::atom()]
-Sorted list of unique variables used in the template's body. The
-list can be used for determining which variable bindings need to be
-passed to the render/3 function.
+Sorted list of unique variables used in the template's body. The list
+can be used for determining which variable bindings need to be passed
+to the render/3 function.
Differences from standard Django Template Language
View
3  README_I18N
@@ -61,5 +61,6 @@ compilation options and add `translation_fun` option to `my_compiled_template:re
4. Update strings. Edit po files on $(GETTEXT_DIR)/lang/default/$(LOCALE)/gettext.po
translating msgstr to the translated version of their corresponding msgstr.
- 5. Generate localized templates providing `locale` compile option or use runtime
+ 5. Generate localized templates providing `blocktrans_fun` and
+ `blocktrans_locales` compile options or use runtime
translation via `translation_fun` rendering option.
Please sign in to comment.
Something went wrong with that request. Please try again.