2016-11-04 14 views
0

私のデータベースが英語であり、ウェブサイトが読み込まれている間にヒンディー語でデータを表示したいという問題に固執しました。英語でデータベースを変換し、ヒンディー語でウェブページに表示する方法

言語が変換された言語のドロップダウンを使用したくないため、ヒンディー語のフォントでしかデータを表示しません。

+0

それが意味するところ、**私のデータベースは**英語の言語でありますか?データを英語で保存していて、ヒンディー語で表示したいですか?はいの場合は、** utf8_general_ci **のデータベース列コレクション属性を使用して、ヒンディー語でデータベースに格納する方がよいでしょう。 – SHAZ

+0

はい!私はヒンディー語のテーブルをmysqlを使って変換できますか? –

+0

私は英語でデータを取得できますか?PHPを使用してウェブに変換してください –

答えて

0

はい、あなたはGoogle's translate 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; 

を使用してPHPでそれを行うことができます注:それが支払われますAPI

関連する問題