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

org.opentripplanner.ext.transmodelapi.TransmodelGraphQLUtils Maven / Gradle / Ivy

package org.opentripplanner.ext.transmodelapi;

import graphql.schema.DataFetchingEnvironment;
import java.util.Locale;
import java.util.Map;

public class TransmodelGraphQLUtils {

    public static Locale getLocale(DataFetchingEnvironment environment) {
      String argLang = environment.getArgument("language");
      if (argLang != null) {
        return Locale.forLanguageTag(argLang);
      }

      Map localContext = environment.getLocalContext();
      if (localContext != null && localContext.get("locale") != null) {
        return (Locale) localContext.get("locale");
      }

      return environment.getLocale();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy