Search in sources :

Example 1 with TranslatedString

use of org.opentripplanner.util.TranslatedString in project OpenTripPlanner by opentripplanner.

the class AlertsUpdateHandler method deBuffer.

/**
 * convert a protobuf TranslatedString to a OTP TranslatedString
 *
 * @return A TranslatedString containing the same information as the input
 */
private I18NString deBuffer(GtfsRealtime.TranslatedString input) {
    Map<String, String> translations = new HashMap<>();
    for (GtfsRealtime.TranslatedString.Translation translation : input.getTranslationList()) {
        String language = translation.getLanguage();
        String string = translation.getText();
        translations.put(language, string);
    }
    return translations.isEmpty() ? null : TranslatedString.getI18NString(translations);
}
Also used : TranslatedString(org.opentripplanner.util.TranslatedString) I18NString(org.opentripplanner.util.I18NString) TranslatedString(org.opentripplanner.util.TranslatedString)

Aggregations

I18NString (org.opentripplanner.util.I18NString)1 TranslatedString (org.opentripplanner.util.TranslatedString)1