All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wix.restaurants.helpers.Localizer Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package com.wix.restaurants.helpers;

import com.wix.restaurants.i18n.Locale;
import com.wix.restaurants.i18n.LocalizedString;

public class Localizer {
    private final Locale defaultLocale;
    private final Locale locale;

    public Localizer(Locale defaultLocale, Locale locale) {
        this.defaultLocale = defaultLocale;
        this.locale = locale;
    }

    public String localize(LocalizedString localizedString) {
        String localized = localizedString.get(locale);
        if (localized == null) {
            localized = localizedString.get(defaultLocale);
        }
        return ((localized != null) ? localized : "");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy