Ygg01/Linguini

HasMessages does not work with attributes

Closed this issue · 3 comments

You can only check by removing attributes first:

var attributes = key.LastIndexOf('.');
if (attributes > 0)
	return bundle.HasMessage(key.Remove(attributes));
else
	return bundle.HasMessage(key);
Ygg01 commented

Wait. Why are you using HasMessage like that?

Usually, you want to get the exact msg-id.attr combination. Why would you get the underlying message if it uses attribute syntax?

I might add it but HasMessage was meant to be used by tooling to behave like TryGetMessage.

We use it for CI checks if the message is missing in .ftl or unused.