ShahiTranslate

Setting Up Google Translate API

Overview

This guide walks you through obtaining and configuring a Google Translate API key for ShahiTranslate Pro.

Why You Need an API Key

Google Translate API allows ShahiTranslate Pro to automatically translate your content. Without an API key, you’ll be limited to manual translations only.

Benefits:

    1. Instant translation of all content
    2. Support for 130+ languages
    3. High-quality neural machine translation
    4. Scalable for large websites
    5. Costs:

    6. $20 per 1 million characters
    7. Free tier: $300 credit for new Google Cloud accounts
    8. Pay only for what you use
    9. Step-by-Step Setup

      Step 1: Create Google Cloud Account

    10. Go to Google Cloud Console
    11. – Visit: https://console.cloud.google.com/
      – Click “Get started for free” or “Sign in”

    12. Sign In or Create Account
    13. – Use existing Google account or create new one
      – Accept terms of service

    14. Enter Billing Information
    15. – Required even for free tier
      – No charges without explicit approval
      – You’ll get $300 free credit for 90 days

    16. Complete Account Setup
    17. – Enter your country
      – Agree to terms
      – Click “Start my free trial” or “Activate”

      Step 2: Create a New Project

    18. Access Project Selector
    19. – Click the project dropdown at top of page
      – Next to “Google Cloud Platform” logo

    20. Create New Project
    21. – Click “New Project” button
      – Or use existing project if you have one

    22. Name Your Project
    23. – Enter name: e.g., “My Website Translation”
      – Project ID: auto-generated (can customize)
      – Organization: Leave as “No organization” (unless you have one)

    24. Create Project
    25. – Click “Create” button
      – Wait for project creation (10-30 seconds)

    26. Select Your Project
    27. – Ensure new project is selected in dropdown
      – You’ll see project name at top of page

      Step 3: Enable Cloud Translation API

    28. Open API Library
    29. – Click “☰” menu (hamburger icon, top-left)
      – Select “APIs & Services” → “Library”
      – Or visit: https://console.cloud.google.com/apis/library

    30. Search for Translation API
    31. – In search box, type “Cloud Translation API”
      – Click on “Cloud Translation API” from results

    32. Enable API
    33. – Click “Enable” button
      – Wait for activation (few seconds)
      – You’ll see “API enabled” message

    34. Verify Enabled
    35. – Go to “APIs & Services” → “Dashboard”
      – You should see “Cloud Translation API” in the list

      Step 4: Create API Key

    36. Open Credentials Page
    37. – Click “☰” menu → “APIs & Services” → “Credentials”
      – Or visit: https://console.cloud.google.com/apis/credentials

    38. Create Credentials
    39. – Click “+ CREATE CREDENTIALS” at top
      – Select “API key” from dropdown

    40. Copy API Key
    41. – A popup appears with your new API key
      – Click “Copy” button or manually copy the key
      Important: Save this key securely!
      – It looks like: AIzaSyABCD1234567890EFGHIJ_KLMNOPqrstuv

    42. Click “Close”
    43. – You can always view the key later in Credentials page

      Step 5: Restrict API Key (Recommended)

      For security, restrict what your API key can do:

    44. Edit API Key
    45. – In Credentials page, click on your newly created API key
      – Or click the ✏️ edit icon

    46. Application Restrictions
    47. – Choose “HTTP referrers (web sites)”
      – Click “Add an item”
      – Enter your website URLs:
      https://yourwebsite.com/*
      https://www.yourwebsite.com/*
      – Add staging site if you have one

    48. API Restrictions
    49. – Choose “Restrict key”
      – Select “Cloud Translation API” from list
      – Uncheck everything else

    50. Save Changes
    51. – Click “Save” button at bottom
      – Restrictions take a few minutes to apply

      Step 6: Set Up Billing Alerts

      To avoid unexpected charges:

    52. Go to Billing
    53. – Click “☰” menu → “Billing”
      – Select your billing account

    54. Create Budget Alert
    55. – Click “Budgets & alerts” in left sidebar
      – Click “+ CREATE BUDGET”

    56. Configure Budget
    57. – Name: “Translation API Budget”
      – Projects: Select your project
      – Services: Select “Cloud Translation API”
      – Amount: $25 or your preferred limit

    58. Set Alert Thresholds
    59. – 50% of budget
      – 90% of budget
      – 100% of budget
      – Enter your email for notifications

    60. Save Budget
    61. – Click “Finish”
      – You’ll receive email alerts at set thresholds

      Step 7: Add API Key to ShahiTranslate Pro

    62. Access Plugin Settings
    63. – In WordPress admin, go to “ShahiTranslate Pro” → “Settings”
      – Click “API Settings” tab

    64. Enter API Key
    65. – Paste your API key in “Google Translate API Key” field
      – The key you copied in Step 4

    66. Choose API Version
    67. V2 (Basic): Standard translation, faster, cheaper
      V3 (Advanced): Better quality, more features, slightly more expensive
      – Recommended: Start with V2

    68. Configure Additional Settings
    69. Format: HTML (preserves formatting) or Text (plain text)
      Model: Leave as default unless you have specific needs

    70. Test API Key
    71. – Click “Test API Connection” button
      – Should see “Connection successful” message
      – If error, double-check API key and that API is enabled

    72. Save Settings
    73. – Click “Save Changes” button
      – API key is now active

      Verifying Setup

      Test Translation

    74. Visit Your Site
    75. – Go to your website’s front end
      – Look for the language switcher

    76. Switch Language
    77. – Click switcher and select a language
      – Page should reload with translated content

    78. Check Dashboard
    79. – Go to ShahiTranslate Pro → Dashboard
      – Look at “API Usage” section
      – Should show recent API calls

      Monitor Google Cloud Console

    80. Check API Usage
    81. – Go to Google Cloud Console
      – APIs & Services → Dashboard
      – Click “Cloud Translation API”
      – View usage metrics and quotas

    82. View Billing
    83. – Go to Billing → Transactions
      – See charges for API usage
      – Remember: $20 per 1 million characters

      Understanding Costs

      How Charging Works

    84. Charged per character translated
    85. $20 USD per 1 million characters
    86. Excludes spaces, HTML tags, and special characters
    87. Minimum charge: $0 (no minimum)
    88. Example Calculations

      Small Blog:

    89. 50 posts
    90. 500 words per post = 25,000 total words
    91. ~150,000 characters
    92. 3 languages
    93. Total: 450,000 characters
    94. Cost: ~$9 one-time
    95. Medium Site:

    96. 200 pages
    97. 1000 words per page = 200,000 words
    98. ~1,200,000 characters
    99. 5 languages
    100. Total: 6,000,000 characters
    101. Cost: ~$120 one-time
    102. Large Site:

    103. 1000 pages
    104. 800 words average = 800,000 words
    105. ~4,800,000 characters
    106. 5 languages
    107. Total: 24,000,000 characters
    108. Cost: ~$480 one-time
    109. Note: With caching enabled (recommended), you pay only once for translation. Subsequent visitors see cached translations at no cost.

      Reducing Costs

    110. Enable Aggressive Caching
    111. – Cache for 90 days or permanent
      – Reduces repeat translation costs to zero

    112. Translate Selectively
    113. – Only translate published content
      – Exclude comments, archives, search results

    114. Use Manual for Key Pages
    115. – Translate important pages manually
      – Use automatic for less critical content

    116. Translation Memory
    117. – Reuses common phrases automatically
      – Included in plugin, no extra cost

    118. Limit Languages
    119. – Only activate languages you truly need
      – Each language multiplies character count

      Troubleshooting

      “API Key Invalid” Error

      Causes:

    120. Key copied incorrectly (extra spaces, incomplete)
    121. API not enabled in Google Cloud Console
    122. Restrictions too strict
    123. Solutions:

    124. Copy API key again carefully
    125. Verify Cloud Translation API is enabled
    126. Check API key restrictions (temporarily remove all restrictions to test)
    127. Create new API key
    128. “Quota Exceeded” Error

      Cause: Reached free tier limit or set quota

      Solutions:

    129. Check Google Cloud Console → Quotas
    130. Enable billing if on free tier
    131. Increase quota if possible
    132. Wait for quota reset (usually daily)
    133. “Authentication Failed” Error

      Cause: API key restrictions blocking your site

      Solutions:

    134. Edit API key in Google Cloud Console
    135. Add your site URL to HTTP referrer restrictions
    136. Or temporarily disable restrictions to test
    137. Wait 5 minutes for restrictions to update
    138. Charges Higher Than Expected

      Check:

    139. Go to Google Cloud Console → Billing → Reports
    140. Filter by Cloud Translation API
    141. See detailed usage breakdown
    142. Common Causes:

    143. Cache not working (translations repeat)
    144. Many languages activated
    145. Dynamic content being translated repeatedly
    146. No exclusions set (translating everything)
    147. Solutions:

    148. Enable and verify cache is working
    149. Set up exclusions for unnecessary content
    150. Limit active languages
    151. Use manual translation for frequently changing content
    152. Best Practices

      Security

    153. Never share your API key publicly
    154. Don’t commit API key to GitHub or version control
    155. Use environment variables or wp-config.php for storage
    156. Restrict API key to your domain only
    157. Rotate API keys periodically (annually)
    158. Performance

    159. Enable caching (reduces API calls by 90%+)
    160. Use V2 API unless you need V3 features (faster)
    161. Batch translations when possible
    162. Monitor usage to catch issues early
    163. Cost Management

    164. Set budget alerts at $25, $50, $100 or your limits
    165. Review monthly usage in Google Cloud Console
    166. Enable cache warming for predictable costs
    167. Use manual translation for high-traffic pages
    168. Alternative: Google Cloud Service Account

      For advanced users or high-volume sites:

      Benefits

    169. More secure than API keys
    170. Better for server-to-server communication
    171. Supports more advanced features
    172. Setup (Brief Overview)

    173. Create Service Account in Google Cloud
    174. Download JSON key file
    175. Grant “Cloud Translation API User” role
    176. Upload JSON key to plugin settings
    177. Note: Service accounts are more complex. Use API keys unless you have specific needs.

      Next Steps

      Now that your API key is set up:

    178. Quick Start Guide
    179. Translation Methods
    180. Improving Translation Quality
    181. Translation Cache
    182. Need Help?

    183. Google Cloud Support: https://cloud.google.com/support
    184. Google Cloud Documentation: https://cloud.google.com/translate/docs
    185. ShahiTranslate Pro Support: Through your account dashboard

Share this article

Was this article helpful?

Help us improve our documentation

Still need help?

Our support team is ready to assist you with personalized guidance for your workspace.

Submit a support ticket