trsteel88 / TrsteelCkeditorBundle

Symfony2 bundle for easy integration of the CKEditor WYSIWYG
97 stars 58 forks source link

Translation files not loaded? #42

Closed ioleo closed 11 years ago

ioleo commented 11 years ago

Today I run composer.phar update and got checked out to current master. I see my ckeditor was upgraded to 4.0.1, but unfortunately, it's in English (fallback language).

Is there something wrong with lang file?

My config:

trsteel_ckeditor:
    class:            Trsteel\CkeditorBundle\Form\Type\CkeditorType
    transformers:     ['strip_js', 'strip_css', 'strip_comments']
    toolbar:          ['document', 'clipboard', 'editing', 'paragraph', 'tools', '/', 'links', 'insert', 'basicstyles', 'colors', 'styles']
    toolbar_groups:
        document:     ['Source']
        clipboard:    ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']
        editing:      ['Find', 'Replace', '-', 'SelectAll']
        basicstyles:  ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']
        paragraph:    ['Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']
        links:        ['Link', 'Unlink', 'Anchor']
        insert:       ['NumberedList', 'BulletedList', '-', 'Image', 'Table', 'HorizontalRule']
        styles:       ['Format']
        colors:       ['TextColor', 'BGColor']
        tools:        ['Maximize', 'ShowBlocks']
    ui_color:         '#E4E4E4'
    startup_outline_blocks: true
    width:            100%  #Integer or %
    height:           200   #Integer or %
    language:         'pl'

What's wrong?

trsteel88 commented 11 years ago

I cannot replicate this issue. I just installed the latest version and set my language to 'pl' and it works.

trsteel_ckeditor:
    width: 50%
    toolbar:
        - document
        - basicstyles
        - paragraph
        - clipboard
    toolbar_groups:
        document:
            - Source
        basicstyles:
            - Bold
            - Italic
            - Underline
            - Strike
            - RemoveFormat
    language: 'pl'

Screen Shot 2013-02-15 at 8 03 15 PM

What does your source look like?

ioleo commented 11 years ago

Source from Chrome Developer Tool:

<script type="text/javascript">
CKEDITOR.replace("edit_page_content",{
    width: '100%',
    height: '200',
    language: 'pl',
    uiColor: "#E4E4E4",
    startupOutlineBlocks: 1,
    filebrowserBrowseUrl: '/elfinder/',
    filebrowserImageBrowseUrl: '/elfinder/',
    contentsCss: '/bundles/wrsdesignwebsite/css/ckeditor.css',
    toolbar: [{"name":"document","items":["Source"]},{"name":"clipboard","items":["Cut","Copy","Paste","PasteText","PasteFromWord","-","Undo","Redo"]},{"name":"editing","items":["Find","Replace","-","SelectAll"]},{"name":"paragraph","items":["Outdent","Indent","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"]},{"name":"tools","items":["Maximize","ShowBlocks"]},"\/",{"name":"links","items":["Link","Unlink","Anchor"]},{"name":"insert","items":["NumberedList","BulletedList","-","Image","Table","HorizontalRule"]},{"name":"basicstyles","items":["Bold","Italic","Underline","Strike","Subscript","Superscript","-","RemoveFormat"]},{"name":"colors","items":["TextColor","BGColor"]},{"name":"styles","items":["Format"]}]
});
</script>

The toolbar part in more human-readable form (only added ENTER and SPACEs which should not change anything in the logic):

toolbar: [
    {
        "name":"document",
        "items":["Source"]
    },
    {
        "name":"clipboard",
        "items":["Cut","Copy","Paste","PasteText","PasteFromWord","-","Undo","Redo"]
    },
    {
        "name":"editing",
        "items":["Find","Replace","-","SelectAll"]
    },
    {
        "name":"paragraph",
        "items":["Outdent","Indent","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"]
    },
    {
        "name":"tools",
        "items":["Maximize","ShowBlocks"]
    },
    "\/",
    {
        "name":"links",
        "items":["Link","Unlink","Anchor"]
    },
    {
        "name":"insert",
        "items":["NumberedList","BulletedList","-","Image","Table","HorizontalRule"]
    },
    {
        "name":"basicstyles",
        "items":["Bold","Italic","Underline","Strike","Subscript","Superscript","-","RemoveFormat"]
    },
    {
        "name":"colors",
        "items":["TextColor","BGColor"]
    },
    {
        "name":"styles",
        "items":["Format"]
    }
]
ioleo commented 11 years ago

Here is how my editor looks like:

ckelingo

trsteel88 commented 11 years ago

Can you try my config above and see if it works please?

ioleo commented 11 years ago

Tried to change array notation (from [ ... ] to -), but did not help:

trsteel_ckeditor:
    class:        Trsteel\CkeditorBundle\Form\Type\CkeditorType
    ui_color:     "#E4E4E4"
    width:        100%
    height:       200
    language:     pl
    startup_outline_blocks:   true
    transformers:
        - strip_js
        - strip_css
        - strip_comments
    toolbar:
        - document
        - clipboard
        - editing
        - paragraph
        - tools
        - /
        - links
        - insert
        - basicstyles
        - colors
        - styles
    toolbar_groups:
        document:
            - Source
        clipboard:
            - Cut
            - Copy
            - Paste
            - PasteText
            - PasteFromWord
            - -
            - Undo
            - Redo
        editing:
            - Find
            - Replace
            - -
            - SelectAll
        basicstyles:
            - Bold
            - Italic
            - Underline
            - Strike
            - Subscript
            - Superscript
            - -
            - RemoveFormat
        paragraph:
            - Outdent
            - Indent
            - -
            - JustifyLeft
            - JustifyCenter
            - JustifyRight
            - JustifyBlock
        links:
            - Link
            - Unlink
            - Anchor
        insert:
            - NumberedList
            - BulletedList
            - -
            - Image
            - Table
            - HorizontalRule
        styles:
            - Format
        colors:
            - TextColor
            - BGColor
        tools:
            - Maximize
            - ShowBlocks
    filebrowser_browse_url:
        route: elfinder_show
    filebrowser_image_browse_url:
        route: elfinder_show

Gonna try copypaste your config now.

ioleo commented 11 years ago

Copying your config did not help either, result:

<script type="text/javascript">
CKEDITOR.replace("edit_page_content",{
    width: '50%',
    language: 'pl',
    startupOutlineBlocks: 1,
    contentsCss: '/bundles/wrsdesignwebsite/css/ckeditor.css',
    toolbar: [{"name":"document","items":["Source"]},{"name":"basicstyles","items":["Bold","Italic","Underline","Strike","RemoveFormat"]},{"name":"paragraph","items":["NumberedList","BulletedList","-","Outdent","Indent","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"]},{"name":"clipboard","items":["Cut","Copy","Paste","PasteText","PasteFromWord","-","Undo","Redo"]}]
});
</script>

screen1

ioleo commented 11 years ago

@trsteel88 as far as I can see, the options are passed down, but for some reason the default language is used, maybe the locale file cannot be read (or is not loaded?)

On this screen (my html output) I don't see file Resources/public/lang/pl.js being loaded (i suppose it should be)?

screen2

trsteel88 commented 11 years ago

The issue was with the ckeditor 4.0.1 files from https://github.com/trsteel88/TrsteelCkeditorBundle/pull/37

I have updated ckeditor (https://github.com/trsteel88/TrsteelCkeditorBundle/commit/224847a3b5a0d70048f8bc034556ddbb7b7a7c00) and it looks like it is functioning correctly now. Please clear your cache and run the assets:install command

ioleo commented 11 years ago

@trsteel88 thank you, issue is fixed