atticoos / angular-translate-once

:currency_exchange: Extension of angular-translate for one time bindings
53 stars 11 forks source link

Fallback to find key in element value #9

Closed rehleinBo closed 8 years ago

rehleinBo commented 8 years ago

If the plugin fails in any case. The keys are displayed instead of nothing.

atticoos commented 8 years ago

Great call -- a fallback could be very useful here.

atticoos commented 8 years ago

Correct me if I'm wrong, but it appears that this is to support a scenario where no key is provided in the translate-once="" attribute?

In this scenario, wouldn't it be better to just stop early and avoid an attempt to translate since there's nothing to translate?

I also wonder about the scenario where the key is supplied, but there's no entry

rehleinBo commented 8 years ago

First if all. Please excuse my bad English.

You are right. Today at work we had a little argument about this and I was on your side.

My colleagues argument was, that in case of a failure or another error the ui would display the translation keys. When the key is set via the attribute value the ui will be empty. The second one is that 'angular-translate' supports the same behavior.

We did this change today for a new project and I thought that this change could be useful. It doesn't destroy anything from my point of view.

I will not be mad if you reject the request. :-) As long as I can use your great enhamcement of angular-translate for me with my little tweak.

Am 5. Januar 2016 23:22:43 MEZ, schrieb Atticus White notifications@github.com:

Correct me if I'm wrong, but it appears that this is to support a scenario where no key is provided in the translate-once="" attribute?

In this scenario, wouldn't it be better to just stop early and avoid an attempt to translate since there's nothing to translate?

I also wonder about the scenario where the key is supplied, but there's no entry


Reply to this email directly or view it on GitHub: https://github.com/ajwhite/angular-translate-once/pull/9#issuecomment-169152501

atticoos commented 8 years ago

The second one is that 'angular-translate' supports the same behavior.

This right here is the most convincing thing to me. I think the goal of this project should be to provide the exact same behavior as the core module, with the added benefit of one-time bindings.

If angular-translate behaves this way, this should as well.

Thank you for your response! I'm going to do some exploration of these edge cases with angular-translate and I'll get back to you :smile:

PS - your English is just fine :ok_hand:

atticoos commented 8 years ago

I'm going to merge this and make a few changes and clean up the failing build. For instance, I don't think we need to do anything if there is no key -- just leave the element as it is.

Thanks for this contribution! It has sparked a few ideas in how to better handle missing translations. I've opened #10 to track that issue.

atticoos commented 8 years ago

Ah - actually, I see what you did. You are supporting scenarios where the translation key is the actual text value of the element. Got it.

Little communication problem. Your PR is good :+1:

rehleinBo commented 8 years ago

Thanks a lot for merging. :-)

Am 6. Januar 2016 02:22:14 MEZ, schrieb Atticus White notifications@github.com:

Ah - actually, I see what you did. You are supporting scenarios where the translation key is the actual text value of the element. Got it.

Little communication problem. Your PR is good :+1:


Reply to this email directly or view it on GitHub: https://github.com/ajwhite/angular-translate-once/pull/9#issuecomment-169189046