PHP Classes

PHP Automatic Language Translation: Generate app translation scripts using Yandex

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 615 All time: 5,116 This week: 74Up
Version License PHP version Categories
lang-translate 4GNU Lesser Genera...5.3Localization, PHP 5, Web services, Co...
Description 

Author

This package can generate application translation scripts automatically using Yandex Translation API.

The main class can get the list of texts and languages to translate from a separate class and sends HTTP requests to the Yandex Translation API Web servers to translate the texts to other given languages.

The class generates a PHP script with an array with all retrieved translations. This script should be included by the actual application that will use the translated texts.

Picture of Ciaran Moore
  Performance   Level  
Name: Ciaran Moore <contact>
Classes: 5 packages by
Country: United Kingdom
Age: 38
All time rank: 2221103 in United Kingdom
Week rank: 227 Up14 in United Kingdom Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php

include_once('includes/lang/languages.array');

?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
</head>
<body>
<div class="container-fluid">
    <div class="center-block">
        <h1>Test Translation Text</h1><br /><br />
    <?php
       
       
echo $lang['fr_FR']['HELLO'] . '! <br />';
        echo
$lang['de_DE']['WELCOME_TO'] . '<br />';
        echo
$lang['pl_PL']['PLEASE_FEEL'] . ',' . $lang['pl_PL']['DONT_TOUCH'];

   
?>

    </div>
</div>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</body>
</html>



Details

Language Translations

A PHP Class to create a static array of translations, to use on your website

General Usage

Pull the latest code or Download the Zip file, then add to your project. <br /> You will need to register for a free API Key from Here <br /> In includes/configuration.php file, Change the API Key to the one you receive from Yandex, and change the LANG_PATH definition to a world writable folder for your file to be output to. <br /> Then you can open and edit the includes/lang/language.php file, with the array of sentences / paragraphs / words you would like to translate. <br /> Once you have created your array of phrases, simply call the classes/Lang.php file from your browser or your command line ( php classes/Lang.php ) to create your static array.

Currently Supported Languages

Here is a list of the currently supported languages using this method;

      

| Language Code | Language | |---------|---------| | sq | Albanian| | ar | Arabic| | hy | Armenian| | az | Azerbaijani| | be | Belarusian| | bs | Bosnian| | bg | Bulgarian| | ca | Catalan| | zh | Chinese| | hr | Croatian| | cs | Czech| | da | Danish| | nl | Dutch| | et | Estonian| | fi | Finnish| | fr | French| | ka | Georgian| | de | German| | el | Greek| | he | Hebrew| | hu | Hungarian| | is | Icelandic| | id | Indonesian| | it | Italian| | ja | Japanese| | ko | Korean| | lv | Latvian| | lt | Lithuanian| | mk | Macedonian| | ms | Malay| | mt | Maltese| | no | Norwegian| | fa | Persian| | pl | Polish| | pt | Portuguese| | ro | Romanian| | ru | Russian| | sr | Serbian| | sk | Slovak| | sl | Slovenian| | es | Spanish| | sv | Swedish| | tt | Tatar| | th | Thai| | tr | Turkish| | uk | Ukrainian| | vi | Vietnamese|


  Files folder image Files (7)  
File Role Description
Files folder imageclasses (2 files)
Files folder imageincludes (1 file, 1 directory)
Plain text file index.php Example Example script
Plain text file README.md Doc. Auxiliary data

  Files folder image Files (7)  /  classes  
File Role Description
  Plain text file cURL.php Class Class source
  Plain text file Lang.php Class Class source

  Files folder image Files (7)  /  includes  
File Role Description
Files folder imagelang (2 files)
  Plain text file configuration.php Conf. Configuration script

  Files folder image Files (7)  /  includes  /  lang  
File Role Description
  Plain text file language.php Class Configuration script
  Plain text file languages.array Output Sample output

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:615
This week:0
All time:5,116
This week:74Up