Hello,
I’m building a custom authenticator using the provided SPIs and having some trouble translating labels in the ProviderConfigProperty in the AuthenticatorFactory SPI.
For example:
private static final List<ProviderConfigProperty> CONFIG_PROPERTIES = new ArrayList<ProviderConfigProperty>();
static {
ProviderConfigProperty property;
property = new ProviderConfigProperty();
property.setName(CloudIdentityUtilities.CONFIG_TENANT_FQDN);
property.setLabel("{{:: 'ciConfigFqdn' | translate}}");
property.setType(ProviderConfigProperty.STRING_TYPE);
property.setHelpText(new FormMessage("ciConfigFqdnHelpText").getMessage());
CONFIG_PROPERTIES.add(property);
}
I see in the keycloak source code the syntax:
property.setLabel(“{{:: ‘ciConfigFqdn’ | translate}}”);
is used to translate(?) labels, but it doesn’t work for my authenticator - it just shows “ciConfigFqdn” as the label for the authenticator’s configuration page.
Currently I place my messages_en.properties in the correct location in the JAR (resources/theme-resources/messages) and the custom login forms that I use correctly reference the messages using the ${msg(“messageKey”)} syntax.
I’ve also tried setting the label to new FormMessage(“ciConfigFqdn”).toString() and that doesn’t seem to work either (the message for the key is not retrieved?).
Is there a standard way (or another way) to achieve translations inside the authenticator java code?
Thanks in advance.