Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Bugfix: redactor > translation of missing strings or languages

Because of the different redactor packages and translation strings in different places some redactor elements are not translated. Here is the solution how you can add your own language files to redactor.

affected file 1: include > client > header.inc.php
affected file 2: include > staff > footer.inc.php
affected file 3: js > redactor-osticket.js

1. Step: Create a new folder "redactor" in "include" > "i18n"

2. Step: Create your own language file using the attached one as blueprint. Important hints:
The filename has to be according exactly to your osticket language filename, e.g. "en_US.js", "fr_FR.js", "de_DE.js"
The language string in the first line has to be lowercase, e.g. "en_us", "fr_fr", "de_de"

3. Step: Save your redactor language file in "include" > "i18n" > "redactor"

4. Step: Open "js" > "redactor-osticket.js" and change line 326 to 328 from:

            if (c.lang && c.lang.toLowerCase() != 'en_us' &&
                    $.Redactor.opts.langs[c.short_lang])
                options['lang'] = c.short_lang;

to:

            if (c.lang && c.lang.toLowerCase() != 'en_us' &&
                    $.Redactor.opts.langs[c.lang.toLowerCase()])
                options['lang'] = c.lang.toLowerCase();

5. Step: Open "include" > "client" > "header.inc.php" and add the following line in the <head> section:

    <script src="<?php echo ROOT_PATH; ?>include/i18n/redactor/<?php echo Internationalization::getCurrentLanguage().'.js'; ?>"></script>

6. Step: Open "include" > "staff" > "footer.inc.php" and add the following somewhere before the closing </body> tag:

   
<script src="<?php echo ROOT_PATH;
?>include/i18n/redactor/<?php echo
Internationalization::getCurrentLanguage().'.js';
?>"></script>

That's it, now redactor uses your language file and if you are missing a string it falls back to the english version [ that's the reason why we change redactor-osticket.js, in our opionen it's better to get the english string back than none ;o) ].

Best regards,
Jürgen


Tagged:

Comments

  • hello, thank you! Unfortunately there is no blueprint-file attached.

    Regards, Afox
  • edited June 18
    @Afox
    I don't know why, but my attached zip doesn't appear. Please save the following code to "en_US.js":

    RedactorOptions.langs['en_us'] = {
            "html" : "HTML",
            "video" : "Insert Video",
            "image" : "Insert Image",
            "table" : "Table",
            "link" : "Link",
            "link_insert" : "Insert link",
            "link_edit" : "Edit link",
            "unlink" : "Unlink",
            "formatting" : "Formatting",
            "paragraph" : "Normal text",
            "quote" : "Quote",
            "code" : "Code",
            "header1" : "Header 1",
            "header2" : "Header 2",
            "header3" : "Header 3",
            "header4" : "Header 4",
            "header5" : "Header 5",
            "bold" : "Bold",
            "italic" : "Italic",
            "fontcolor" : "Font Color",
            "backcolor" : "Back Color",
            "unorderedlist" : "Unordered List",
            "orderedlist" : "Ordered List",
            "outdent" : "Outdent",
            "indent" : "Indent",
            "cancel" : "Cancel",
            "insert" : "Insert",
            "save" : "Save",
            "_delete" : "Delete",
            "insert_table" : "Insert Table",
            "insert_row_above" : "Add Row Above",
            "insert_row_below" : "Add Row Below",
            "insert_column_left" : "Add Column Left",
            "insert_column_right" : "Add Column Right",
            "delete_column" : "Delete Column",
            "delete_row" : "Delete Row",
            "delete_table" : "Delete Table",
            "rows" : "Rows",
            "columns" : "Columns",
            "add_head" : "Add Head",
            "delete_head" : "Delete Head",
            "title" : "Title",
            "image_position" : "Position",
            "none" : "None",
            "left" : "Left",
            "right" : "Right",
            "center" : "Center",
            "image_web_link" : "Image Web Link",
            "text" : "Text",
            "mailto" : "Email",
            "web" : "URL",
            "video_html_code" : "Video Embed Code or Youtube/Vimeo Link",
            "file" : "Insert File",
            "upload" : "Upload",
            "download" : "Download",
            "choose" : "Choose",
            "or_choose" : "Or choose",
            "drop_file_here" : "Drop file here",
            "align_left" : "Align text to the left",
            "align_center" : "Center text",
            "align_right" : "Align text to the right",
            "align_justify" : "Justify text",
            "horizontalrule" : "Insert Horizontal Rule",
            "deleted" : "Deleted",
            "anchor" : "Anchor",
            "link_new_tab" : "Open link in new tab",
            "underline" : "Underline",
            "alignment" : "Alignment",
            "filename" : "Name (optional)",
            "edit" : "Edit",
            "upload_label" : "Drop file here or "
    };
  • thanks, is there also a German version? :)
    Maybe you can try single txt-files instead of a zip.

    Regards
  • edited June 18
    @Afox Sorry, our version is customized to our modified redactor with a lot of additional strings. Just go to https://imperavi.com/redactor/docs/languages/ and download it. You can copy and paste most of them...

    But the translation of the file above is done in 20 Minutes. Maybe you will translate it German and post it here for other users to download.
Sign In or Register to comment.