Giter Club home page Giter Club logo

Comments (18)

mashpie avatar mashpie commented on August 15, 2024

on my "secret" ToDo List

from i18n-node.

enyo avatar enyo commented on August 15, 2024

+1

from i18n-node.

mashpie avatar mashpie commented on August 15, 2024

maybe like

__('Hello :firstname :lastname', {'firstname': 'Max', 'lastname': 'Mustermann'});

just to get a feeling of prefered syntax

from i18n-node.

enyo avatar enyo commented on August 15, 2024

:firstname looks better but it might introduce problems when there is no space afterwards?
Update: See my comment below #39 (comment)

from i18n-node.

fkrauthan avatar fkrauthan commented on August 15, 2024

what about ${firstname} so we have a defined start and end.

from i18n-node.

enyo avatar enyo commented on August 15, 2024

I'd prefer something like ::firstname ... two :s should very rarely happen in real live, and it's faster to type that than having to open and close parenthesis.

from i18n-node.

fkrauthan avatar fkrauthan commented on August 15, 2024

@enyo the problem is not the start the problem is the end in your examples That's why i would prefer %key% or ${key} that should normal never occur in a normal text.

from i18n-node.

enyo avatar enyo commented on August 15, 2024

In this case there is a very limited set of variable names that can be substituted, so it's not the same as with coffeescript variables (for example), since it just needs to go through all key names and replace :KEY_NAME in the string.
The end is only a problem if you have two variables like firstName and firstNameSuffix, in which case :firstNameSuffix could be confused with :firstName + Suffix. But that could easily be handled by the script as well (always take the longest key name possible).
(And.. yes, my first comment on that was wrong. Having a space after doesn't change anything)

from i18n-node.

fkrauthan avatar fkrauthan commented on August 15, 2024

But this could create very unexpected behaviour. A clear end delimiter is much better. Because with one I can easily see which keys I have for translation and what is normal translation.

from i18n-node.

enyo avatar enyo commented on August 15, 2024

Mh. I think that it's extremely rare to have substitutions immediately followed by letters. Normally a substitution will be followed by a point, or space. So this behaviour will lead to confusion very rarely.
I like the :key_name syntax because it's the same as in oracle's bind variables. Using ${keyName} is a bit strange because, if you use coffeescript or jade, you're used to #{keyName}. This could result in very confusing translation strings.

from i18n-node.

mashpie avatar mashpie commented on August 15, 2024

well and it should't interfere with possible templating engines, which leads to a configurable interpolation option anyway :)

from i18n-node.

fkrauthan avatar fkrauthan commented on August 15, 2024

That's the reason why I would vote for % % it's clear. Easy to read and shouldn't affect any template languages as far as I know. Oracles bind variables use : as the beginning and space as the end.

from i18n-node.

enyo avatar enyo commented on August 15, 2024

%key% looks fine to me too. I'm just really opposed to ${key}. (Also because it's common for programmers to write that, but the people writing translations mostly aren't programmers.)

from i18n-node.

matthewarkin avatar matthewarkin commented on August 15, 2024

+1

from i18n-node.

fkrauthan avatar fkrauthan commented on August 15, 2024

Any news on that?

from i18n-node.

matthewarkin avatar matthewarkin commented on August 15, 2024

I noticed the fork at matthias/i18n-node has support for mustache in the message strings

from i18n-node.

mashpie avatar mashpie commented on August 15, 2024

it's about to get merged - tracked in #76 I just wanted to get a quick review on it but didn't find time yet

from i18n-node.

mashpie avatar mashpie commented on August 15, 2024

released in 0.5.0 https://github.com/mashpie/i18n-node#mustache-support

from i18n-node.

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.