Giter VIP home page Giter VIP logo

canvas_react_i18n's People

Contributors

amireh avatar jenseng avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jenseng

canvas_react_i18n's Issues

<span> instead of <div>?

although if your <Text> contains block elements, you probably do want a <div>

one though would be we could make it configurable/overridable? e.g. <Text tag="span">...

keys inferred incorrectly

Because we call inferKey before we extract the wrappers, the key is being inferred from the intermediate string containing markup, not the final string. This is not a huge deal, but it could result in more strings being sent off to translators than necessary. For example, given:

var foo = <Text>hello <b>{user}</b></Text>;
var bar = <Text>hello <em>{user}</em></Text>;

you get the following keys/strings:

hello_b_user_b_97d65af2: "hello *%{user}*"
hello_em_user_em_885c56ce: "hello *%{user}*"

Ideally they should use the same key, since they are the same string, i.e.

hello_user_34eefdb3: "hello *%{user}*"

Note: the fix for this might be similar in nature to the one for #4, i.e. we might need to change the order we transform and possibly transform wrappers/placeholders concurrently (as is done in i18nliners's erb and i18nliner-handlebars)

Conflict between JSX's interpretation of curly brackets and I18n.t()

I18n.t() calls expect variables for interpolation to be wrapped by %{} and JSX expects anything between {} to be evaluated in the running context.

A workaround for JSX is to wrap the item inside another pair of {}, e.g:

{'%{my_variable}'}

To make this work, the transformer has to look for such tokens and remove the wrapping {} on compilation (because at this stage we're no longer dealing with raw JSX, but compiled JS instead.)

de-dup wrappers

it'd be nice to de-dup identical wrappers like we do in i18nliner(.rb) and i18nliner-handlebars (an example spec here). that should keep the asterisks from getting out of control in the translation.

support wrappers with multiple nodes

currently if you do <Text>Hello <b><em>world</em></b></Text> you get two wrappers with no whitespace between them, rather than a single wrapper. depending on what else you have going on in the string, i18nliner may apply it incorrectly. for example, <b><em>foo</em></b> <i>bar</i> will result in <i>foo</i> <i>bar</i>, since the intermediate string simply has two pairs of ***

example spec we should try to support

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.