Giter VIP home page Giter VIP logo

Comments (15)

jamesarosen avatar jamesarosen commented on May 28, 2024

I have no objection to omitting the tag. I don't even mind if that's the default. The t helper does support bound interpolations, though, so it'll need Metamorph tags.

from ember-i18n.

rupurt avatar rupurt commented on May 28, 2024

Great! I'll have a look at getting it to work with metamorph tags

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

I think the correct behavior should be

  1. {{t "foo"}} => <script id="metamorph-1-start"></script>Foo<script id="metamorph-1-end"></script>
  2. {{t "foo" tagName="span"}} => <span>Foo</span>
  3. {{t "foo" bound="false"}} => Foo

/cc @rapheld

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

@rupurt did you ever give this a try? I'm going to (finally) try to get this done in the next few days.

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

I think this will be fairly straightforward to do if we use Ember.Handlebars.registerBoundHelper, but that's only available on Ember 1.0 and this library supports Ember 0.9.x. I'm having trouble getting bindings working without tags in Ember 0.9.

from ember-i18n.

rupurt avatar rupurt commented on May 28, 2024

Sorry I've been unresponsive on this issue. I've not had time to creating a patch.

Do you really want to support ember < 1.0?

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

If this is on v1.x of Ember-I18n, it must support Ember 0.9. If we do it only on the v2.0 branch, it can rely on Ember 1.0.

from ember-i18n.

pivotal-medici avatar pivotal-medici commented on May 28, 2024

Ok. I think I might try something on the v2.0 branch

-- AK

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

Awesome :)

from ember-i18n.

sihuang avatar sihuang commented on May 28, 2024

Hi, guys, any update on this one?

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

@sihuang the v1 series needs to stay compatible with Ember 0.9.x, which means it's all-but-impossible to do this there. It should be quite straightforward on the v2 branch, though, since that only supports Ember 1.0, which has registerBoundHelper. I haven't had a chance to work on the v2 branch much, but I can pick this up after I'm back from traveling next week if nobody else has had a chance before then.

from ember-i18n.

sihuang avatar sihuang commented on May 28, 2024

That's great you will be looking into this yourself. I have no problem updating to Ember 1.0. Thanks again.

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

Now that Ember 1.0 is out, I tried to do this. Unfortunately, registerBoundHelper doesn't accept a tagName. It always emits a Metamorph tag.

I tried a couple of things, but ended up just really frustrated. I understand the need for Metamorph, but I really hate how much it screws with CSS selectors.

The best we can do easily is

{{t "foo.bar" tagName="h3"}}

emits

<script id="metamorph-123-start"></script>
<h3>Foo Bar</h3>
<script id="metamorph-123-end"></script>

Unfortunately, that's a pretty big breaking change, CSS-wise.

I also tried writing a version of the helper using registerHelper (not registerBoundHelper) and using Ember._MetamorphView or Ember.View, depending on whether a tagName is passed. I got this partially working, but the bindings get very challenging.

I'd love some help on this, especially if the core team have any thoughts. /cc @wycats @tomdale @ebryn @wagenet

from ember-i18n.

wagenet avatar wagenet commented on May 28, 2024

@jamesarosen can you not use :nth-of-type?

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

Sure. What I'm saying is that it's a breaking change. I would prefer to introduce as few as possible, even though it's a major version release.

from ember-i18n.

Related Issues (20)

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.