Ben Cherry 15 лет назад
Родитель
Сommit
e54ef155e6
4 измененных файлов: 27 добавлений и 1 удалений
  1. +6
    -0
      CHANGES.md
  2. +18
    -0
      README.md
  3. +2
    -0
      THANKS.md
  4. +1
    -1
      mustache.js

+ 6
- 0
CHANGES.md Просмотреть файл

@@ -1,5 +1,11 @@
# mustache.js Changes

## 0.3.1-twitter (12/3/2010)

* Added i18n {{_i}}{{/i}} support
* fixed double-rendering bug
* added Rhino test-runner alongside JavaScriptCore

## 0.3.1 (??-??-????)

## 0.3.0 (21-07-2010)


+ 18
- 0
README.md Просмотреть файл

@@ -223,6 +223,20 @@ translation _before_ any rendering is done. For example:
alert(Mustache.to_html(template, view));
// alerts "Mae Matt yn defnyddio mustache.js!"

### The TRANSLATION-HINT Pragma

Some single words in English have different translations based on usage context. Mustache.js supports this with the TRANSLATION-HINT pragma. For example, the word "Tweet" can be used as a noun, or a verb. The following template is ambiguous:

<div class="tweet-button">{{_i}}Tweet{{/i}}</div>

By adding a pragma, we can provide the right context for a given template:

{{%TRANSLATION-HINT mode=tweet_button}}

<div class="tweet-button">{{_i}}Tweet{{/i}}</div>

This will lookup every translation in that template with the mode, e.g. `_('Tweet', {_mode: "tweet_button"})`, which your gettext implementation can handle as appropriate.

## Escaping

mustache.js does escape all values when using the standard double mustache
@@ -279,6 +293,10 @@ own iteration marker:
{{bob}}
{{/foo}}

### TRANSLATION-HINT

See the "Internationalization" section above for info on this pragma.

## F.A.Q.

### Why doesn’t Mustache allow dot notation like `{{variable.member}}`?


+ 2
- 0
THANKS.md Просмотреть файл

@@ -18,3 +18,5 @@ Mustache.js wouldn't kick ass if it weren't for these fine souls:
* Jason Smith / jhs
* Aaron Gibralter / agibralter
* Ross Boucher / boucher
* Matt Sanford / mzsanford
* Ben Cherry / bcherry

+ 1
- 1
mustache.js Просмотреть файл

@@ -126,7 +126,7 @@ var Mustache = function() {

// for each {{_i}}{{/i}} section do...
return html.replace(regex, function(match, content) {
var translation_mode = undefined;
var translation_mode;
if (that.pragmas && that.pragmas["TRANSLATION-HINT"] && that.pragmas["TRANSLATION-HINT"]['mode']) {
translation_mode = { _mode: that.pragmas["TRANSLATION-HINT"]['mode'] };
} else if (context['_mode']) {


Загрузка…
Отмена
Сохранить