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

Best practise to handle missing interpolation values? #103

Open
Strajk opened this issue Mar 4, 2018 · 1 comment
Open

Best practise to handle missing interpolation values? #103

Strajk opened this issue Mar 4, 2018 · 1 comment

Comments

@Strajk
Copy link

Strajk commented Mar 4, 2018

As a developer, I would like to know when I forget to provide interpolation values. Do you have some best practice to do that?

Throwing exception is probably too much, but a warning is too little :)

polyglot.extend({
  "hello_name": "Hola, %{name}."
});

polyglot.t("hello_name", {});
=> "Hola, %{name}." // => 💣💥
@ljharb
Copy link
Collaborator

ljharb commented Mar 4, 2018

Sometimes this is intentional - for example, if you're sending a partially interpolated string from the server to the browser to finish there. Do you have a suggestion?

In general tho this seems like the kind of thing that's addressed with testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants