I am new to Vaadin and am trying to get I18N localization to work. As an implementation example, I attempted to follow the steps on the Internationalization training video and an initial test, I am trying to get the Hint text on the login screen to display by getting the text from the translation.properties Resource Bundle file, but when I click on “Forgot password” on the login screen, I get “!{login.hint.message.key}!” instead of the text “Hint: same as username”.
I would really appreciate it if I could be pointed in the right direction, as to what I am missing or where I am going wrong.
Your I18NProvider does not wrap the key inside !{ ... }! if it doesn’t find the key in the bundle. If you look at the only usage of I18NProvider::getTranslation (at Component::getTranslation), you will see that it does that wrapping because it doesn’t find your I18NProvider in the first place.
Thank you for the swift response. I am using Spring, However, I have attempted placing the @Component annotation, as follows (please see extract of TranslationProvider.java below) and the issue still persists:
…
import com.vaadin.flow.i18n.I18NProvider;
import org.springframework.stereotype.Component;
import java.text.MessageFormat;
import java.util.*;
@Component
public class TranslationProvider implements I18NProvider {