<%
// Outputs a list of discussion channels available for a topic.
//
// Parameters:
//
//  $0  The mailing list name
//  $1  The newsgroup name
//  $2  The class name to use for the list (null if none)
//  $3  Name of the topic/community (was $0 in CommunityBox template)
//  $4  Twitter ID (null if none)
//  $5  Stack Overflow tag (null if none)

var lang = env.locale; /* get the page language */ ; 
var mailingList, newsgroup, googleGroup, webFeed, stackOverflow, twitter;

/* Translation Targets
    * " mailingList"
	* " newsgroup"
	* " googleGroup"
	* " webFeed"
    * " stackOverflow"
    * " twitter"
*/
switch(lang) {
	case 'ca':
		mailingList = " com una llista de correu";
		newsgroup = " com un grup de discussió";
		googleGroup = " com un grup de Google";
		webFeed = " com un canal web";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'cs':
		mailingList = " e-mailovou konferenci";
		newsgroup = " diskuzní skupinu";
		googleGroup = " Google Group";
		webFeed = " RSS kanál";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'de':
		mailingList = "Mailing-Liste";
		newsgroup = "Newsgroup";
		googleGroup = "Google Group";
		webFeed = "Web-Feed";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'es':
		mailingList = " como lista de correo";
		newsgroup = " como grupo de noticias";
		googleGroup = " como grupo de Google";
		webFeed = " como RSS";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'fi':
		mailingList = " sähköposti listana";
		newsgroup = " uutisryhmänä";
		googleGroup = " Google Rymänä";
		webFeed = " RSS kanál";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'fr':
		mailingList = " Liste de diffusion";
		newsgroup = " 		newsgroup";
		googleGroup = " Groupe Google";
		webFeed = " Flux de syndication";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'it':
		mailingList = " Mailing list";
		newsgroup = " Newsgroup";
		googleGroup = " Google Groups";
		webFeed = " Feed RSS";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'ja':
		mailingList = " メーリングリストとして";
		newsgroup = " ニュースグループとして";
		googleGroup = " Google Group として";
		webFeed = " フィードとして";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'ko':
		mailingList = " 메일링 리스트";
		newsgroup = " 뉴스그룹";
		googleGroup = " Google 그룹";
		webFeed = " 웹 Feed";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'pl':
		mailingList = " jako listę dyskusyjna";
		newsgroup = " jako 		newsgroup";
		googleGroup = " jako grupę Google";
		webFeed = " jako kanał";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
    case 'ru':
    	mailingList = " Почтовая рассылка";
		newsgroup = " newsgroup";
		googleGroup = " Группы Google";
		webFeed = " Новостная лента";
        stackOverflow = " Stack Overflow";
        twitter = " Твиттер";
		break;
	case 'zh-CN':
		mailingList = " 邮件列表";
		newsgroup = " 新闻组";
		googleGroup = " Google Group(中文)";
		webFeed = " Web feed";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	case 'zh-TW':
		mailingList = " 郵件討論";
		newsgroup = " 新聞群組";
		googleGroup = " Google 群組";
		webFeed = " feed 消息來源";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
	default:
		mailingList = "Mailing list";
		newsgroup = "Newsgroup";
		googleGroup = "Google Group";
		webFeed = "RSS feed";
        stackOverflow = " Stack Overflow";
        twitter = " Twitter";
		break;
}

// Build the Stack Overflow URL using the SO tag

var stackOverflowURL = null;
var soHTML = "";

if ($5 && ($5 != undefined) && ($5.length != 0)) {
    stackOverflowURL = "http://stackoverflow.com/questions/tagged/" + $5;
    soHTML = "<li>" + web.link(stackOverflowURL, stackOverflow) + "</li>";
}

/*** OLD HACK THAT GUESSED (USUALLY WRONG) SO LINKS ***
if ($3 == "Firefox OS" || $3 == "Open Web Apps") {
   stackoverflowURL = "http://stackoverflow.com/questions/tagged/firefox-os";
} else if ($3 == "Developer tools") {
   stackoverflowURL = "http://stackoverflow.com/questions/tagged/firefox-developer-tools";    
} else {
   stackoverflowURL = "http://stackoverflow.com/r/mozilla";    
} */

// Build the Twitter link (if any)

var twitterURL = null;
var twitHTML = "";

if ($4 && ($4 != undefined) && ($4.length != 0)) {
    twitterURL = "https://twitter.com/" + $4;
    twitHTML = "<li>" + web.link(twitterURL, twitter) + "</li>";
}

/***** OLD GUESSING MECHANISM FOR CREATING TWITTER LINKS °°°°°
if ($3 == "Firefox OS") {
   twitterURLFragment = "Boot2Gecko";
} else if ($3 == "Developer tools") {
   twitterURLFragment = "FirefoxDevTools";    
} else if ($3 == "Open Web Apps") {
   twitterURLFragment = "mozappsdev";    
} else {
   twitterURLFragment = "mozilla";    
}
*/

// Build the <ul> element

var listElem = "<ul";

if ($2 && ($2 != undefined)) {
    listElem += " class='" + $2 + "'";
}
%>

<%-listElem %>
  <li><%- web.link('https://lists.mozilla.org/listinfo/' + $0, mailingList) %></li>
  <%- twitHTML %>
  <%- soHTML %>
  <li><%- web.link('http://groups.google.com/group/' + $1, googleGroup) %></li>
  <li><%- web.link('http://groups.google.com/group/' + $1 + '/feeds', webFeed) %></li>
</ul>
Search for pages that use Template:DiscussionList to see example use cases and how many pages use this macro.

Document Tags and Contributors

Last updated by: Sebastianz,