Arcade Voyage: Language, Voice, and Multimodal Processing | GSP049
Solution for Arcade Voyage: Language, Voice, and Multimodal Processing | GSP049. 1 lab: GSP049. Fast copy-paste commands for Google Cloud.
GSP049 — Translate Text with the Cloud Translation API
Estimated time: 10 minutes
# 🚀 Translate Text with the Cloud Translation API | GSP049 > ⚠️ **Disclaimer:** This is an independent, community-made walkthrough created for educational purposes, hands-on practice, and Google Cloud certification preparation. This guide is designed to help learners understand the Cloud Translation API, language translation, language detection, API services, and secure API key configuration through practical exercises. Always attempt the lab yourself first and follow Google Cloud Skills Boost
clear
CYAN='\033[0;96m'
BOLD='\033[1m'
RESET='\033[0m'
echo "${CYAN}${BOLD}"
echo " ____ _ _ _ __ ___ "
echo " / __ \ | | (_) | / _| / _ \ "
echo " | | | |_ __ | |__ _| |_ ___ | |_ | | | |_ __ ___ "
echo " | | | | '__| '_ \| | __| / _ \ | _|| | | | '_ \ / __| "
echo " | |__| | | | |_) | | |_ | (_) | | | | |_| | |_) \__ \ "
echo " \____/|_| |_.__/|_|\__| \___/ |_| \___/| .__/|___/ "
echo " | | "
echo " |_| "
echo "${RESET}"
echo "▶ Checking project configuration..."
export REGION=$(gcloud compute project-info describe \
--format="value(commonInstanceMetadata.items[compute-region])")
gcloud config set compute/region $REGION >/dev/null 2>&1
echo "▶ Enabling required APIs..."
gcloud services enable apikeys.googleapis.com
gcloud services enable translate.googleapis.com
echo "▶ Creating API Key restricted to Cloud Translation API..."
gcloud services api-keys create \
--display-name="orbit" \
--api-target=service=translate.googleapis.com
echo "▶ Waiting for Google Cloud propagation..."
sleep 10
echo "▶ Retrieving API Key..."
KEY_NAME=$(gcloud services api-keys list --format="value(name)" --filter="displayName=orbit" --limit=1)
API_KEY=$(gcloud services api-keys get-key-string "$KEY_NAME" --format="value(keyString)")
export API_KEY=${API_KEY}
echo "✓ Stage completed successfully."
echo "Your API_KEY has been generated and exported: ${API_KEY}"