Skip to content

Commit

Permalink
Remove unused & deprecated google translate feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kpicaza committed Feb 4, 2022
1 parent 4efdabb commit c8a24c6
Show file tree
Hide file tree
Showing 78 changed files with 59 additions and 4,598 deletions.
15 changes: 13 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@
"support": {
"issues": "https://github.com/sifophp/SIFO/issues"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/sifophp/sifoweb.git"
}
],
"require": {
"php": ">=7.2",
"adodb/adodb-php": "^5.21",
"geoip/geoip": "^1.17",
"neutron/sphinxsearch-api": "^2.0",
"phpmailer/phpmailer": "^6.0",
"psr/container": "^1.0",
"sifophp/sifo-common-instance": "^2.14",
"smarty/smarty": "^3.1",
"symfony/dotenv": "^3.3.1|^4.3.1|^5.0.1",
"symfony/yaml": "^3.2|^4.3.1|^5.0.1",
Expand All @@ -34,9 +39,12 @@
"twig/twig": "^2.0"
},
"require-dev": {
"adlawson/vfs": "^0.12.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^5.0",
"symfony/var-dumper": "^3.2"
"sifophp/sifo-common-instance": "*",
"sifophp/sifoweb": "@dev",
"symfony/var-dumper": "^5.4"
},
"scripts": {
"cs-check": "phpcs src --colors",
Expand All @@ -47,6 +55,9 @@
"sort-packages": true
},
"autoload": {
"psr-4": {
"Sifo\\": "src/Sifo/"
},
"classmap" : [
"src/Sifo"
]
Expand Down
3 changes: 3 additions & 0 deletions instances/example/config/configuration_files.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
include ROOT_PATH . '/vendor/sifophp/sifo-common-instance/config/configuration_files.config.php';
$config['locale'] = 'instances/example/config/locale.config.php';
6 changes: 6 additions & 0 deletions instances/example/config/locale.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
include ROOT_PATH . '/vendor/sifophp/sifo-common-instance/config/locale.config.php';
$config['messages_en_US'] = 'instances/example/locale/messages_en_US.php';
$config['messages_es_ES'] = 'instances/example/locale/messages_es_ES.php';
$config['urlparams_en_US'] = 'instances/example/locale/urlparams_en_US.php';
$config['urlparams_es_ES'] = 'instances/example/locale/urlparams_es_ES.php';
3 changes: 3 additions & 0 deletions instances/example/locale/messages_en_US.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
// Key contains requested string, value contains text shown on the website.
$translations["%1 is in da house, kind'a funny uh?"] = "The developer %1 is behind the scenes, serious work on progress...";
Empty file.
Empty file.
Empty file.
11 changes: 5 additions & 6 deletions src/Sifo/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

namespace Sifo;

use Exception;
use Psr\Container\ContainerInterface;

$is_defined_in_vhost = (false !== ini_get('newrelic.appname') && 'PHP Application' !== ini_get('newrelic.appname'));
Expand All @@ -32,8 +33,6 @@
/**
* Class Bootstrap
*/
require_once ROOT_PATH . '/vendor/sifophp/sifo/src/Sifo/Exceptions.php';
require_once ROOT_PATH . '/vendor/sifophp/sifo/src/Sifo/Config.php';
require_once ROOT_PATH . '/vendor/autoload.php';

class Bootstrap
Expand Down Expand Up @@ -110,7 +109,7 @@ public static function execute( $instance_name, $controller_name = null, $contai
* @param string $controller The controller in folder/action form.
*
* @return Controller
* @throws Exception_DependencyInjector
* @throws \Sifo\Exception_DependencyInjector
*/
public static function invokeController( $controller, $container = null )
{
Expand Down Expand Up @@ -269,18 +268,18 @@ public static function dispatch( $controller = null, $container = null )
}
}
// Don't know what to do after Domain is evaluated. Goodbye:
catch ( DomainsException $d )
catch (DomainsException $d )
{
Headers::setResponseStatus( 404 );
Headers::send();
echo "<h1>{$d->getMessage()}</h1>";
die;
}
catch ( ControllerException $e )
catch (ControllerException $e )
{
self::_dispatchErrorController( $e->getPrevious() );
}
catch ( \Exception $e )
catch ( Exception $e )
{
self::_dispatchErrorController( $e );
}
Expand Down
37 changes: 0 additions & 37 deletions src/Sifo/I18N.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,41 +234,4 @@ static public function getLocale()
return self::$locale;

}

/**
* Identify the used language.
*
* @param string $text The text to identify.
* @return string Language Iso.
*/
static public function identifyUsedLanguage( $text )
{
if ( !( isset( self::$google_translate_api_instance ) ) )
{
include_once ROOT_PATH . '/vendor/sifophp/sifo/src/' . Config::getInstance()->getLibrary( 'googleTranslate' ) . '/googleTranslate.class.php';
self::$google_translate_api_instance = new \GoogleTranslateWrapper();
}
$result = self::$google_translate_api_instance->detectLanguage( $text );

return $result['language'];
}

/**
*
* @param string $text Texto to translate
* @param string $dest_iso Language destination
* @return string Translated text.
*/
static public function translateTo( $text, $dest_iso )
{
if ( !( isset( self::$google_translate_api_instance ) ) )
{
include_once ROOT_PATH . '/vendor/sifophp/sifo/src/' . Config::getInstance()->getLibrary( 'googleTranslate' ) . '/googleTranslate.class.php';
self::$google_translate_api_instance = new \GoogleTranslateWrapper();
}
self::$google_translate_api_instance->translatedText = '';

return self::$google_translate_api_instance->translate( $text, $dest_iso );
}

}
Loading

0 comments on commit c8a24c6

Please sign in to comment.