Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9.1
    • Component/s: Blocks, Language
    • Labels:
      None
    • Environment:
      MySQL 5.0.45
      PHP 5.2.5
      Apache-Webhosting with linux
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      35016

      Description

      Hello,

      I am working currently on a multilanguage moodlesite with 4 languages. The content and title of content is translated as expected.

      If inserting an HTML-block, I can insert multilang content, but no multilang title of this block. The language settings in the title are ignored by Moodle and it shows all titles at once.

      Is there any way to also translate the title of HTML-blocks? (I am running Moodle 1.9)

      Regards, Daniel

        Activity

        Hide
        Daniel Schimrik added a comment - - edited

        A fix was posted by Gordon Bateson in Moodle-language forum, see:http://moodle.org/mod/forum/discuss.php?d=93491
        1. open "blocks/moodleblock.class.php" with a text editor
        2. locate the following line (around line 356 in the "_title_html" function):
        $title .= '<h2>'.$this->title.'</h2>';
        3. change the above line to:
        $title .= '<h2>'.filter_text($this->title).'</h2>';
        4. saved the modified file

        I tried this solution and it works perfectly on my 1.9 installation

        Show
        Daniel Schimrik added a comment - - edited A fix was posted by Gordon Bateson in Moodle-language forum, see: http://moodle.org/mod/forum/discuss.php?d=93491 1. open "blocks/moodleblock.class.php" with a text editor 2. locate the following line (around line 356 in the "_title_html" function): $title .= '<h2>'.$this->title.'</h2>'; 3. change the above line to: $title .= '<h2>'.filter_text($this->title).'</h2>'; 4. saved the modified file I tried this solution and it works perfectly on my 1.9 installation
        Hide
        Martin Dougiamas added a comment -

        Dongsheng, can you apply this in 1.9 and head ?

        Show
        Martin Dougiamas added a comment - Dongsheng, can you apply this in 1.9 and head ?
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Shouldn't this be format_text() or better format_string() ????

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Shouldn't this be format_text() or better format_string() ???? Ciao
        Hide
        Eloy Lafuente (stronk7) added a comment -

        And, also... wouldn't be better to make that exclusively in the html block, in the specialization() method? (to save some filtering for constant block titles?)

        reciao

        Show
        Eloy Lafuente (stronk7) added a comment - And, also... wouldn't be better to make that exclusively in the html block, in the specialization() method? (to save some filtering for constant block titles?) reciao
        Hide
        Martin Dougiamas added a comment -

        format_string() for sure. And just html block too. Good catch Eloy!

        Show
        Martin Dougiamas added a comment - format_string() for sure. And just html block too. Good catch Eloy!
        Hide
        Petr Škoda added a comment -

        verified, closing

        Show
        Petr Škoda added a comment - verified, closing
        Hide
        Paulo Matos added a comment -

        Hi folks!

        I just hit this the other day, Title only works if I do:

        format_string(filter_string(.....))

        or am I missing something here.

        Cheers,

        Paulo Mato

        Show
        Paulo Matos added a comment - Hi folks! I just hit this the other day, Title only works if I do: format_string(filter_string(.....)) or am I missing something here. Cheers, Paulo Mato
        Hide
        Dongsheng Cai added a comment -

        Thanks for reporting, Paulo, I added format_string to block base class.
        Feel free to reopen it if you still got problem

        Show
        Dongsheng Cai added a comment - Thanks for reporting, Paulo, I added format_string to block base class. Feel free to reopen it if you still got problem
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Uhm... I don't get this change, Dongsheng.

        Wasn't supposed that this was already applied to the html block? I don't see the point about adding it globally to the base class at all. +1 to revert before weekly.

        Paulo, perhaps it isn't working for you because in order to get titles working you need to enable the "filterall" setting?

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Uhm... I don't get this change, Dongsheng. Wasn't supposed that this was already applied to the html block? I don't see the point about adding it globally to the base class at all. +1 to revert before weekly. Paulo, perhaps it isn't working for you because in order to get titles working you need to enable the "filterall" setting? Ciao
        Hide
        Petr Škoda added a comment -

        I agree with Eloy here, blocks should be responsible to formating of text there, in any case we should not commit changes today...

        Show
        Petr Škoda added a comment - I agree with Eloy here, blocks should be responsible to formating of text there, in any case we should not commit changes today...
        Hide
        Eloy Lafuente (stronk7) added a comment -

        reverted to original versions. Thanks Dongsheng for quick commit!

        Show
        Eloy Lafuente (stronk7) added a comment - reverted to original versions. Thanks Dongsheng for quick commit!

          People

          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: