CodeIgniter Forums
Language file editor interface - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Language file editor interface (/showthread.php?tid=23046)

Pages: 1 2


Language file editor interface - El Forum - 09-28-2009

[eluser]jcavard[/eluser]
Language Editor v0.1 based on jEditable.

demo | source

This is my first contribution to the CodeIgniter community. I needed a way to easily edit the language file without having to open the file itself. So I thought I'd design a (very) simple non-obstrusive interface.

This is pretty simple with very little configuration to do. This actually consists in

edit in place script from http://www.appelsiini.net/projects/jeditable
Code:
/js/jquery.jeditable.mini.js

a simple config file
Code:
/system/application/config/language_editor.php

a controller
Code:
/system/application/controllers/editor.php

the library
Code:
/system/application/libraries/language_editor.php

a slightly modified version of the language helper
Code:
/system/helpers/language_helper.php

At the moment, it doesn't support adding new text element, but it's on the to-do list. It's in very beta stage, so if you come across bugs, report'em here.

Also, be aware that there is no security layer at all. Meaning, anyone can access this controller, unless you add your own security check. So be careful if you ever use it on a production site.

demo it here
download it here

Feedback are welcomed!


Language file editor interface - El Forum - 09-28-2009

[eluser]jcavard[/eluser]
I modified the language helper so it implements the jEditable plugin. If you already use the helper in your page, it will not break anything thing.

Code:
// Added a third optional true/false parameter (default true)
// It allows enableing/disableing of the edit in place feature
function lang($line, $id = '', $eip = true)
{
    $index    = $line;
    
    $CI =& get_instance();
    $CI->config->load('language_editor');
    
    $line = $CI->lang->line($line);
    if ($id != '')
    {
        $line = '<label for="'.$id.'">'.$line."</label>";
    }
    
    // Returns differs if Edit In Place is enabled or not
    if($CI->config->item('enable_eip') && $eip !== false)
        return '<em><p class="eiplang" id="' . $index . '" lang="english">' . $line . '</p></em>';
    else
        return $line;
}



Language file editor interface - El Forum - 09-28-2009

[eluser]jcavard[/eluser]
The config is pretty simple.
Code:
// This is the master switch to disabled edit in place system-wide.
$config['enable_eip']    = true;

// This array contains the different languages.
$config['available_languages']    = array('english');

// This is the path to the language file (included in CI)
// Unless you have you language files somewhere else, do not edit these two params.
$config['path']            = './system/language/';
$config['path_custom']    = './system/application/language/';

// Unless you change the name of the controller, do not edit
$config['base_controller']        = 'index.php/editor/';



Language file editor interface - El Forum - 09-28-2009

[eluser]MaD HamsteR[/eluser]
Syntax errors everywhere.

Like WTF Smile

Code:
$link = "<a >language_editor->_base_controller) . "\">Back to language list</a><br />";


May be just post bug. You should put your code in archive ready for download...


Language file editor interface - El Forum - 09-28-2009

[eluser]jcavard[/eluser]
[removed]


Language file editor interface - El Forum - 09-28-2009

[eluser]freshface[/eluser]
demo url?


Language file editor interface - El Forum - 10-14-2009

[eluser]jcavard[/eluser]
Demo is available here
FEEDBACK ARE WELCOMED!


Language file editor interface - El Forum - 11-06-2009

[eluser]Isern Palaus[/eluser]
Love it! I'll apply it on a website I'm developing. Will notify my results!

Thank you,
Isern


Language file editor interface - El Forum - 11-07-2009

[eluser]Amzad Hossain[/eluser]
SEEMS interesting Smile .. thanks


Language file editor interface - El Forum - 11-07-2009

[eluser]rbcrssn36[/eluser]
Introducing the Kajona Language File Editor, we want to provide a graphical application to edit and manage the text-files of a Kajona installation. Kajona itself is a free Content Management Framework, @see http://www.kajona.de for more details.

Thanks
-------------------------------------------------------------------------------

HVAC Baltimore | Home Remodeling Maryland | Lab Equipment