Google Cloud Translation Purchase: Google Cloud API makes your App multilingual in seconds.

cloud 2026-06-09 阅读 9
3

As a friend of App going to sea or independent independent software development, the most troublesome thing is often not to write core business code, but

Internationalization (i18n)

.

When you are struggling to finish the App and plan to put it on Google Play or App Store to fight for overseas traffic, the reality will give you a slap: there are not only English users in the world, but also huge markets in Spanish, German, French, Japanese and various small languages in Southeast Asia. If you only provide Chinese or English, it is equivalent to directly shutting out 80% of the potential downloads.

"If you find a translation company, a language of thousands of dollars, 10 languages can directly empty you; If you use the traditional form to manually dig hard, every time the App is revised to update a function, you have to re-check the form, which is a nightmare for research and development personnel."

Google Cloud Translate Purchase

Today, I will combine my practical experience in leading the team to sea and teach everyone how to use it.

Google Cloud Translation API (Google Cloud Translation Interface)

, in the code to achieve "one line of command/one line of code" automatically translate your App into more than 100 languages around the world. Don't talk about the concept of virtual, pure dry goods, package teaching package.

The first stage: on the eve of sailing, go to Google cloud backstage to get the "customs clearance key"

Before we can change the code, we need to go to the Google Cloud Console to set up the infrastructure. The process is very simple, a total of three steps:

1. Open the translation service

Sign in to your Google Cloud account.

Enter Cloud Translation API in the search bar at the top of the console.

After clicking to enter, you will see a big blue button [Enable](Enable), click it. The first step is completed when the status changes to "Enabled.

2. fish out your API key (key)

App automated translation scripts require a string of secret keys to invoke Google's computing power.

In the left-side navigation pane, click [APIs and Services] -> [Credentials](Credentials).

Click [Create Credential] at the top of the page and select [API Key] from the drop-down menu.

The system will pop up a string of strings similar to AIzaSyA4xX..., copy it down and keep it on your little book.

🔒Safety reminder for past people: after getting this string of Key, don't be lazy and click "edit" next to it ". Select Qualified Keys in API Restrictions and select only Cloud Translation APIs in the list. In this way, even if this string of keys is accidentally leaked, others can only use it for translation and cannot steal your other expensive Google cloud AI resources.

The second stage: core practical operation-a line of code/command speed

Translation

The underlying logic of App internationalization (Android, iOS, Flutter, or React Native) is actually reading a local resource file (usually

.json

,

.xml

Or

.arb

File).

Purchase Google Cloud Translation

We don't need to ask users to ask Google when the App is running, the sample money is too high and the loading is slow.

The smartest thing to do is to write a local compilation script on your development computer and generate translation files for all languages directly with one line of command.

Below is the most common

JSON format

(Various front-end, cross-platform common) As an example, see how we can use a simple automated script to achieve "one-line code translation".

Local automated translation scripts (logical disassembly):

You just need to prepare one in the project root directory.

translate.js

or

translate.py

The script. Its core logic looks like this:

Plaintext

1. The script reads your original language file: for example, 'zh.json', which contains {"login": "login", "welcome": "welcome back"}

2. Set the list of target languages you want to go to sea: target_languages = ['en', 'es', 'fr', 'ja', 'ko']

3. The script automatically traverses this list, and a line of code calls the Google Cloud API:

👉GoogleCloudTranslate(text = "login", target = "es", key = "your API key")

4. Google Cloud millisecond returns Spanish: "Iniciar sesión"

5. The script automatically generates 'es.json', 'en.json', 'ja.json' locally and puts the translated content into it.

In daily development, when you add 50 new function strings, you only need to type one line of command in the terminal (Terminal):

node translate.js

Or

python translate.py

Ding! In less than 5 seconds, the localization files in more than 100 languages around the world were all automatically filled in.

This is the real "one line of code to go to sea".

The third stage: the real person avoids the pit-how to avoid the "machine turning taste" and let the user stay?

Although the bottom layer of Google translation has been integrated into the semantic understanding of Gemini model, the accuracy is very high, but App development has its particularity. If you turn all over without a brain, funny bugs often appear. Here are three iron laws to avoid rollover:

1. Protect placeholders in the code (e. g.

%s

,

{username}

)

Many App welcome is dynamic, such:

"welcome": "Welcome,%s"

(

%s

It will be replaced with the user name at runtime).

Big Pit: If you throw it directly to Google Translate, it may translate% s into something else, or even add a space between the symbols, causing the App to crash directly when it runs.

Purchase Google Cloud Translation

Solution: In your local translation script, use regular expressions to wrap the special tag% s or {username} with a <notranslate> tag before sending it to Google, for example: Welcome,<notranslate>%s</notranslate>. Google Cloud sees this tag and is smart enough to leave it as it is.

2. Use glossary (Glossary) to lock your brand and game black words

If your App is called "flying widget", directly translated into English may become "Flying Small Component", which sounds extremely earthy.

Solution: Google Cloud Translate supports custom [Glossary](Glossary). You can upload a fixed noun correspondence table on the console in advance, and it is mandatory to keep "FlyWidget" in English when encountering "flying gadgets". When encountering "gold coins" in the game, the Spanish language will always use "Monedas". In this way, the turned-out App will have a high-level sense of big names.

3. Pay attention to the "character explosion" of UI interface"

Warning: Chinese is usually very short (e. g. "OK" is only two words). But when translated into English it would become "Confirm" (seven letters), and when translated into German or Russian it might become a long list of words.

If you write the width of the button when writing the App layout, the text in small languages will directly overflow, overlap or break lines. Therefore, when making multi-language App, UI layout must use flexible layout (Flexbox / Auto Layout) to leave enough space for text to expand and contract.

The fourth stage: about the cost, calculate a refreshing account.

Many people hear "Google Cloud API", the first reaction is: how much does it cost?

In fact, for individual developers and small and medium-sized teams, Google's free quota is incredibly generous:

The first 500000 characters per month are completely free! For an ordinary App, all the buttons and prompts in it add up to about 1000 to 3000 Chinese characters. Even if you translate into 30 languages in one go, the total number of characters is less than 100000.

In other words, in the early stage of your App development, you are completely in the world's top translation computing power of Bai Piao Google Cloud, and you don't need to spend a penny. Even if your App becomes larger and updated frequently in the future, it only needs 20 US dollars for every 1 million characters in excess.

Yuan (about 140 yuan), cost-effective to explode.

Conclusion

In the era of digital sailing, whoever moves fast will get the bonus first.

Don't waste a lot of time arguing with translation companies or manually copying and pasting forms. Take half an hour to connect the Google Cloud Translation API to your development workflow and automatically internationalize one line of commands. You will find that when you spread the "net" of more than 100 languages around the world to the application market, the downloads and advertising revenue from Brazil, France, Indonesia, and Saudi Arabia will tell you with practical actions:

The outside world is really wonderful. Purchase Google Cloud Translation

2
← 返回新闻中心