如何将数据库转换为英语语言,并在网页加载上查看印地语数据


How to convert database in English language and to view data in Hindi on web page load

我遇到了一个问题,我的数据库是英语的,我想在网站加载时查看印地语的数据。

我不想使用已转换语言的语言下拉菜单,我只想查看印地语字体的数据

是的,你可以用PHP使用Google的翻译API。

<?php
// [START translate_quickstart]
// Includes the autoloader for libraries installed with composer
require __DIR__ . '/vendor/autoload.php';
// Imports the Google Cloud client library
use Google'Cloud'Translate'TranslateClient;
// Your Translate API key
$apiKey = 'YOUR_API_KEY';
// Instantiates a client
$translate = new TranslateClient([
    'key' => $apiKey
]);
// Get your database text to translate
$text = 'Hello, world!';
// The target language - hindi -> hi
$target = 'hi';
// Translates some text into Russian
$translation = $translate->translate($text, [
    'target' => $target
]);
echo 'Text: ' . $text . '
Translation: ' . $translation['text'];
// [END translate_quickstart]
return $translation;

注意:这是付费API