Jump to content

language converter in php


rupam_jaiswal

Recommended Posts

Hi,

I have to make a language (literal) converter in php from english to hindi.

i dont want the hindi translation of the word. just typing the same words in hindi

if i type 'baloon' in english, it will convert as it is into hindi ( बलून ) ्

I mean it only typing word 'baloon' in hindi using hindi letters rather than english.

any idea????

Link to comment
https://forums.phpfreaks.com/topic/121672-language-converter-in-php/
Share on other sites

Yeah, you best bet is to have a list of hindi characters and a list of english characters in an array...

 

<?php

$eng = array( 'a', 'A', 'b', 'B', 'c', '... ect' );
$hin = array( 'hindi_a', 'hindi_A', '... ect' );

# then use

$converted = str_replace($eng, $hin, $text);

?>

 

I don't suggest doing this on the fly though. Do the conversion only when the data is modified, and store both versions in the db/file

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.