Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support template literals #112

Open
2 tasks
bajtos opened this issue Aug 8, 2017 · 1 comment
Open
2 tasks

Support template literals #112

bajtos opened this issue Aug 8, 2017 · 1 comment

Comments

@bajtos
Copy link
Member

bajtos commented Aug 8, 2017

Extend strong-globalize to support template literals via tagged template literals.

Sample usage:

const {_}  = require('strong-globalize')();

const name = 'world';
console.log(_`Hello ${name}`);

Preliminary list of tasks:

  • When gathering strings to potentially localize, look for template literals and convert them into messages with indexed placeholders. In the example above, the following messages entry should be created: Hello {0}
  • Implement _ as a tag function applying localization under the hood.
@bajtos
Copy link
Member Author

bajtos commented Aug 8, 2017

An alternative to consider: modify g.f to support two invocations forms:

g.f('Hello %s', name);
g.f`Hello ${name}`;

bajtos referenced this issue in loopbackio/loopback-datasource-juggler Dec 14, 2018
@bajtos bajtos added the major label Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants