Git Product home page Git Product logo

gulp-i18n-preprocess's Introduction

gulp-i18n-preprocess's People

Contributors

t2ym avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

gulp-i18n-preprocess's Issues

[Enhancement] Compound binding support for I18N-target attributes.

This issue is in sync with t2ym/i18n-behavior#46

Compound binding support for I18N-target attributes.

Parameterized:

  attr="Compound binding attribute has [[bound.value]] {{parameters}} in the value string"
  "{{i18nFormat(attrId.0,bound.value,parameters)}}"
  [ "Compound binding attribute has {1} {2} in the value string", "[[bound.value]]", "{{parameters}}" ]

Concatenated: (Parameters with functions cannot be reordered in translation)

  attr2="Compound binding attribute has [[f1(bound.value)]] {{f2(parameters)}} in the value string"
  "{{attrId.0}}[[f1(bound.value)]]{{attrId.2}}{{f2(parameters)}}{{attrId.4}}"
  [ "Compound binding attribute has ", "[[f1(bound.value)]]", " ", "{{f2(parameters)}}", " in the value string" ]

Child templates (dom-repeat, dom-if) are not properly rendered when i18n-format is applied

The issue is synchronous with t2ym/i18n-behavior#20

When i18n-format is automatically applied, child templates such as dom-repeat, dom-if are not properly rendered.

Paragraph with a child template:

  <p id="paragraph">
    A paragraph with 
    <template is="dom-repeat" items="{{text.parameters}}">
      <i>{{item}} </i>
    </template>
    is converted to 
    <code>&lt;i18n-format&gt;</code>.
  </p>

Expected preprocess:

  <p id="paragraph">
    <i18n-format lang="{{effectiveLang}}">
      <span>{{text.paragraph.0}}</span>
      <template is="dom-repeat" items="{{text.parameters}}">
        <i param="1">{{item}} </i>
      </template>
      <code param="2">{{text.paragraph.2}}</code>
    </i18n-format>
  </p>

Actual preprocess: The rendered <i> is not selected for <content select='[param="1"]'></content>.

  <p id="paragraph">
    <i18n-format lang="{{effectiveLang}}">
      <span>{{text.paragraph.0}}</span>
      <template param="1" is="dom-repeat" items="{{text.parameters}}">
        <i>{{item}} </i>
      </template>
      <code param="2">{{text.paragraph.2}}</code>
    </i18n-format>
  </p>

If contents of the child template have more than 1 elements or have compound bindings, i18n-format must not be applied.

[Enhancement] Supply omitted id for thin syntax

Supply omitted id for thin syntax.

Omitted template id:

<link rel="import" href="i18n-element/define-element.html">
<link rel="import" href="i18n-element/i18n-element.html">

<template>
 ...
</template>
<script>
Define = class ThinElement extends BaseElements.I18nElement {
}
</script>

Omitted class name:

<link rel="import" href="i18n-element/define-element.html">
<link rel="import" href="i18n-element/i18n-element.html">

<template id="thin-element">
 ...
</template>
<script>
Define = class extends BaseElements.I18nElement {
}
</script>

Preprocessed:

<link rel="import" href="i18n-element/define-element.html">
<link rel="import" href="i18n-element/i18n-element.html">

<template id="thin-element" localizable-text="embedded">
 ...
</template>
<script>
Define = class ThinElement extends BaseElements.I18nElement {
}
</script>

Design issues:

  • How to handle external scripts <script src="thin-element.js"></script>
  • How to determine id
  • Element name (id) from file name is easier to implement

[Enhancement] Add legacy attribute to dom-module for Polymer 2.x

Add legacy attribute to dom-module for Polymer 2.x compatibility

<link rel="import" href="bower_components/i18n-element/i18n-behavior.html">

<dom-module id="i18n-legacy-element" legacy>
  <template>...</template>
</dom-module>
<script>
Polymer({ is: 'i18n-legacy-element', behaviors: [ BehaviorsStore.I18nBehavior ] });
</script>

An extra insignificant newline is added between the last text and the embedded json

At the beginning of the embedded JSON that is wrapped by <template id="localizable-text">, an extra insignificant newline is added just for prettiness of the preprocessed template. This extra newline causes some test failures in exactly matching textContent strings.

Current newline insertion for pretty looking:

<br>{{text.text_15}}
<template id="localizable-text">
<json-data>
...

Fix to eliminate undesirable side-effects in tests:

<br>{{text.text_15}}<template id="localizable-text">
<json-data>
...

[Enhancement] Selective I18N-target attributes

This issue is in sync with t2ym/i18n-behavior#42.

Support selective I18N-target attributes.

For example, pick up value="Button Label" attribute of <input> tag if type="button"

Example selective attribute:

<input type="button" value="Button Label">

Expected Definition:

<i18n-attr-repo>
  <template id="custom">
    <input value="type=button|submit">
  </template>
</i18n-attr-repo>

Workaround as of version 1.0.1:

<i18n-attr-repo>
  <template id="custom">
    <input label="$"><!-- define label as I18n-target attribute -->
  </template>
</i18n-attr-repo>

<dom-module id="my-element">
  <template>
    <!-- forward to the 'value' attribute -->
    <input id="ok-button"
      value="{{text.model.ok-button.label}}"
      on-click="_ok"
      label="OK">
  </template>
</dom-module>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.