code: static SupportedLanguages listSupportedLanguages(String projectId, String location) {
      try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
  
        LocationName locationName =
            LocationName.newBuilder().setProject(projectId).setLocation(location).build();
        GetSupportedLanguagesRequest getSupportedLanguagesRequest =
            GetSupportedLanguagesRequest.newBuilder().setParent(locationName.toString()).build();
  
        // Call the API
        ApiFuture<SupportedLanguages> future =
            translationServiceClient
                .getSupportedLanguagesCallable()
                .futureCall(getSupportedLanguagesRequest);
  
        SupportedLanguages response = future.get();
        List<SupportedLanguage> languages = response.getLanguagesList();
        for (SupportedLanguage language : languages) {
          System.out.printf("Code: %s\n", language.getLanguageCode());
        }
  
        return response;
  
      } catch (Exception e) {
        throw new RuntimeException("Couldn't create client.", e);
      }
    }
docs: [START translate_list_codes_beta]