I'm writing a API with Code Igniter and I took the advice of a lot of people to use Code Igniter Rest Server library(Git Repo). I've followed the procedure indicated by the developer but I had a problem related to the language loading. As far as I can tell the problem occurs when I require the REST_Controller.php file and in some point this script tries to load a language file and fails. The thing is I put this exact file both in the application and system language/english directory. In the config.php I have this on the language session:
$config['language'] = 'english';
And those are the language paths both to application and system:
application/language/english/rest_controller_lang.php
system/language/english/rest_controller_lang.php
And I still get this error:
Unable to load the requested language file: language/english/rest_controller_lang.php
Appreciate any tip on how to solve this issue.
I had the same issue and solved it.
The problem is that codeigniter can't find the rest_controller translations. You just need to create this file /application/languages/english/rest_controller_lang.php
Then copy & paste this code inside:
<?php
/*
* English language
*/
$lang['text_rest_invalid_api_key'] = 'Invalid API key %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Invalid credentials';
$lang['text_rest_ip_denied'] = 'IP denied';
$lang['text_rest_ip_unauthorized'] = 'IP unauthorized';
$lang['text_rest_unauthorized'] = 'Unauthorized';
$lang['text_rest_ajax_only'] = 'Only AJAX requests are allowed';
$lang['text_rest_api_key_unauthorized'] = 'This API key does not have access to the requested controller';
$lang['text_rest_api_key_permissions'] = 'This API key does not have enough permissions';
$lang['text_rest_api_key_time_limit'] = 'This API key has reached the time limit for this method';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';
$lang['text_rest_unknown_method'] = 'Unknown method';
$lang['text_rest_unsupported'] = 'Unsupported protocol';
The original repository: https://github.com/chriskacerguis/codeigniter-restserver/blob/master/application/language/english/rest_controller_lang.php
if you are using linux server you can directly get it using wget command and row view of git like this,
wget https://raw.githubusercontent.com/chriskacerguis/codeigniter-restserver/master/application/language/english/rest_controller_lang.php
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With