Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/riwert/gtranslator
Translate between multiple languages using Google Translate in PHP simple script.
https://github.com/riwert/gtranslator
curl google-translate php
Last synced: 2 days ago
JSON representation
Translate between multiple languages using Google Translate in PHP simple script.
- Host: GitHub
- URL: https://github.com/riwert/gtranslator
- Owner: riwert
- License: gpl-3.0
- Created: 2018-04-03T17:07:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-03T19:52:37.000Z (almost 7 years ago)
- Last Synced: 2024-11-08T18:43:24.944Z (about 2 months ago)
- Topics: curl, google-translate, php
- Language: PHP
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GTranslator
Translate between multiple languages using Google Translate.## Usage
### Simple text translate
```
translateText($text);```
### Translate array of translations and export to PHP file
```
[
'first' => 'Translate text.',
'second' => 'Translate array.',
'third' => 'Update file with translations.',
]
];$gTranslator = new GTranslator($sourceLanguage, $targetLanguage);
$translations['pl'] = $gTranslator->translateArray($translations['en']);
$gTranslator->exportToPhpFile($translations, 'translations.php');
```
### Update PHP file with translations
```
updateTranslations('translations.php', ['pl', 'de', 'es']);```
PHP file with translations:
```
// translations.php
[
'key' => 'Text to translate.',
],
];```