Jump to:

1835 Posts in 1139 Topics by 554 members

Blog Module

SilverStripe Forums » Blog Module » [ask] different widget title in each language?

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1391 Views
  • medoose
    Avatar
    Community Member
    3 Posts

    [ask] different widget title in each language? Link to this post

    haloo...

    how can i set widget title in different language?
    as this far i can understand that each widget title is set from mysite/code/my_widget.php in line :

    static $title = 'Widget Title';


    my default site is indonesian, and I make it bilingual (Indonesian & English)
    I want each widget title is automatically changed when I choose mysite.com/?locale=en_US

    could it be possible?
    (sorry for my bad english... ;D)

  • lx
    Avatar
    Community Member
    81 Posts

    Re: [ask] different widget title in each language? Link to this post

    Form the Blogmodul i used the SubscribeRSSWidget.
    The Headline of the widget is 'Subscribe via RSS', because its defined in line 12.

    static $title = 'Subscribe via RSS';

    To get a german Widget-headline i put an additional function into blog/code/widgets/SubscribeRSSWidget.php
    (maybe there is a better way without touching the original blogmodul files)

    function Title() {
    return _t("Widget.SUBSCRIBEVIARSS",self::$title);
    }

    So you need an entry in your language file, in my case:

    $lang['de_DE']['Widget']['SUBSCRIBEVIARSS'] = "News als RSS-Feed";


    in mysite/lang/de_DE

  • sajok
    Avatar
    Community Member
    82 Posts

    Re: [ask] different widget title in each language? Link to this post

    thanks for the hack..
    since this is an old post, I'm wondering if you came up with a better solution?

    thanks

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: [ask] different widget title in each language? Link to this post

  • sajok
    Avatar
    Community Member
    82 Posts

    Re: [ask] different widget title in each language? Link to this post

    how can I translate the widget title with the solution you provided?

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: [ask] different widget title in each language? Link to this post

    The same way the page title changes when using translatable is enabled - the widget will only show on the translated version of the widget - rather than the same widget for each page.

  • sajok
    Avatar
    Community Member
    82 Posts

    Re: [ask] different widget title in each language? Link to this post

    still there is no field in the cms where I can translate the blog widget title, and if you mean the language file for blog I just looked at it and there is no entry for the widget title as the title is hard coded.. can you explain to me how did you translate the blog widgets?

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: [ask] different widget title in each language? Link to this post

    ok, I'm sorry I have scanned this and given an answer as how to translate a widget which is what it appeared to be asking for - I don't use the blog module widget. Instead I will move this thread to that area since the question is actually more specfic.

    1391 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.