We're using Google Storage Transfer Service to migrate S3 buckets to Google Cloud Storage, but we're getting a lot of INVALID_ARGUMENT errors. On further investigation, we narrowed it down to the files that have a Content-Language metadata set of en-US. I'm able to reproduce the same error using gsutil setmeta -h "Content-Language:en-US" "gs://<bucket>/*.html" which gives me BadRequestException: 400 Invalid argument.
The docs say "Refer to ISO 639-1 language codes for the supported values of this metadata," and sure enough just setting en works, but through the Google Cloud Console I'm able to set a value of en_US by setting the language to English (United States). I can see that it's calling some Google RPC endpoint with "request":{"@type":"type.googleapis.com/google.internal.cloud.console.clientapi.storage.UpdateObjectRequest","object":{"resourceName":"projects/_/buckets/<bucket>/objects/<object>","objectMetadata":{"contentLanguage":"en_US"}},"fieldMask":"object_metadata.content_language"}
But when I try to set en_US through gsutil or set it in S3 and run Storage Transfer Service I get the same invalid argument error. How do I add a country code to my content language in Google Cloud Storage?