• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang i18n.InitLocalization函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/twstrike/coyim/i18n.InitLocalization函数的典型用法代码示例。如果您正苦于以下问题:Golang InitLocalization函数的具体用法?Golang InitLocalization怎么用?Golang InitLocalization使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了InitLocalization函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Test_account_createSubmenu_setsTheCheckboxesCorrectly

func (*AccountSuite) Test_account_createSubmenu_setsTheCheckboxesCorrectly(c *C) {
	i18n.InitLocalization(&accountMockGlib{})
	g = Graphics{gtk: &accountMockGtk{}, glib: &accountDirectGlibIdleAddMock{}}

	conf := &config.Account{ConnectAutomatically: true, AlwaysEncrypt: true}
	sess := &accountMockSession{config: conf}
	a := &account{session: sess}

	menu := a.createSubmenu()
	createdMenu := menu.(*accountMockMenu)
	c.Assert(createdMenu.menuItems[7].(*accountMockCheckMenuItem).active, Equals, true)
	c.Assert(createdMenu.menuItems[8].(*accountMockCheckMenuItem).active, Equals, true)

	conf.AlwaysEncrypt = false
	menu = a.createSubmenu()
	createdMenu = menu.(*accountMockMenu)
	c.Assert(createdMenu.menuItems[7].(*accountMockCheckMenuItem).active, Equals, true)
	c.Assert(createdMenu.menuItems[8].(*accountMockCheckMenuItem).active, Equals, false)

	conf.ConnectAutomatically = false
	menu = a.createSubmenu()
	createdMenu = menu.(*accountMockMenu)
	c.Assert(createdMenu.menuItems[7].(*accountMockCheckMenuItem).active, Equals, false)
	c.Assert(createdMenu.menuItems[8].(*accountMockCheckMenuItem).active, Equals, false)

	conf.AlwaysEncrypt = true
	menu = a.createSubmenu()
	createdMenu = menu.(*accountMockMenu)
	c.Assert(createdMenu.menuItems[7].(*accountMockCheckMenuItem).active, Equals, false)
	c.Assert(createdMenu.menuItems[8].(*accountMockCheckMenuItem).active, Equals, true)
}
开发者ID:rosatolen,项目名称:coyim,代码行数:31,代码来源:account_test.go


示例2: Test_account_createSubmenu_createsTheGeneralStructure

func (*AccountSuite) Test_account_createSubmenu_createsTheGeneralStructure(c *C) {
	i18n.InitLocalization(&accountMockGlib{})
	g = Graphics{gtk: &accountMockGtk{}, glib: &accountDirectGlibIdleAddMock{}}

	sess := &accountMockSession{config: &config.Account{}}
	a := &account{session: sess}
	menu := a.createSubmenu()
	c.Assert(menu, Not(IsNil))

	createdMenu := menu.(*accountMockMenu)

	c.Assert(createdMenu.menuItems, Not(IsNil))
	c.Assert(createdMenu.menuItems[0].(*accountMockMenuItem).mnemonic, Equals, "[localized] _Connect")
	c.Assert(createdMenu.menuItems[1].(*accountMockMenuItem).mnemonic, Equals, "[localized] _Disconnect")

	_, ok := createdMenu.menuItems[2].(*accountMockSeparatorMenuItem)
	c.Assert(ok, Equals, true)

	c.Assert(createdMenu.menuItems[4].(*accountMockMenuItem).mnemonic, Equals, "[localized] _Edit...")
	c.Assert(createdMenu.menuItems[5].(*accountMockMenuItem).mnemonic, Equals, "[localized] _Remove")

	_, ok = createdMenu.menuItems[6].(*accountMockSeparatorMenuItem)
	c.Assert(ok, Equals, true)

	c.Assert(createdMenu.menuItems[7].(*accountMockCheckMenuItem).mnemonic, Equals, "[localized] Connect _Automatically")
	c.Assert(createdMenu.menuItems[8].(*accountMockCheckMenuItem).mnemonic, Equals, "[localized] Always Encrypt Conversation")
}
开发者ID:rosatolen,项目名称:coyim,代码行数:27,代码来源:account_test.go


示例3: runClient

func runClient() {
	g := gui.CreateGraphics(
		gtka.Real,
		gliba.Real,
		gdka.Real,
		pangoa.Real,
	)

	i18n.InitLocalization(gliba.Real)
	settings.InitSettings(gliba.Real)

	gui.NewGTK(coyimVersion, session.Factory, xmpp.DialerFactory, g).Loop()
}
开发者ID:rosatolen,项目名称:coyim,代码行数:13,代码来源:gtk.go


示例4: Test_account_createSubmenu_setsConnectAndDisconnectSensitivity

func (*AccountSuite) Test_account_createSubmenu_setsConnectAndDisconnectSensitivity(c *C) {
	i18n.InitLocalization(&accountMockGlib{})
	g = Graphics{gtk: &accountMockGtk{}, glib: &accountDirectGlibIdleAddMock{}}

	sess := &accountMockSession{isDisconnected: true, config: &config.Account{}}
	a := &account{session: sess}

	menu := a.createSubmenu()
	createdMenu := menu.(*accountMockMenu)
	c.Assert(createdMenu.menuItems[0].(*accountMockMenuItem).sensitive, Equals, true)
	c.Assert(createdMenu.menuItems[1].(*accountMockMenuItem).sensitive, Equals, false)

	sess.isDisconnected = false
	menu = a.createSubmenu()
	createdMenu = menu.(*accountMockMenu)
	c.Assert(createdMenu.menuItems[0].(*accountMockMenuItem).sensitive, Equals, false)
	c.Assert(createdMenu.menuItems[1].(*accountMockMenuItem).sensitive, Equals, true)
}
开发者ID:rosatolen,项目名称:coyim,代码行数:18,代码来源:account_test.go


示例5: Test_account_createSubmenu_willWatchForThingsToChangeTheDisconnectSensitivity

func (*AccountSuite) Test_account_createSubmenu_willWatchForThingsToChangeTheDisconnectSensitivity(c *C) {
	i18n.InitLocalization(&accountMockGlib{})
	g = Graphics{gtk: &accountMockGtk{}, glib: &accountDirectGlibIdleAddMock{}}

	sess := &accountMockSession{isDisconnected: true, config: &config.Account{}}
	a := &account{session: sess}

	menu := a.createSubmenu()
	disconnectItem := menu.(*accountMockMenu).menuItems[1].(*accountMockMenuItem)

	c.Assert(disconnectItem.sensitive, Equals, false)

	sess.isDisconnected = false
	for _, cc := range sess.events {
		cc <- events.Event{
			Type: events.Connecting,
		}
	}

	waitFor(c, func() bool { return disconnectItem.sensitive })

	sess.isDisconnected = false
	for _, cc := range sess.events {
		cc <- events.Event{
			Type: events.Connected,
		}
	}

	waitFor(c, func() bool { return disconnectItem.sensitive })

	sess.isDisconnected = true
	for _, cc := range sess.events {
		cc <- events.Event{
			Type: events.Disconnected,
		}
	}

	waitFor(c, func() bool { return !disconnectItem.sensitive })
}
开发者ID:rosatolen,项目名称:coyim,代码行数:39,代码来源:account_test.go


示例6: Test_account_createSubmenu_setsActivationCorrectly

func (*AccountSuite) Test_account_createSubmenu_setsActivationCorrectly(c *C) {
	i18n.InitLocalization(&accountMockGlib{})
	g = Graphics{gtk: &accountMockGtk{}, glib: &accountDirectGlibIdleAddMock{}}

	sess := &accountMockSession{config: &config.Account{}}
	a := &account{session: sess}

	menu := a.createSubmenu()
	createdMenu := menu.(*accountMockMenu)

	// We can't really check that these things are set to the correct functions, just that they are set
	// It might be possible to try invoking them and see that they do the right things, at some point
	// For now, too much bother.

	c.Assert(createdMenu.menuItems[0].(*accountMockMenuItem).onActivate, Not(IsNil))
	c.Assert(createdMenu.menuItems[1].(*accountMockMenuItem).onActivate, Not(IsNil))

	c.Assert(createdMenu.menuItems[4].(*accountMockMenuItem).onActivate, Not(IsNil))
	c.Assert(createdMenu.menuItems[5].(*accountMockMenuItem).onActivate, Not(IsNil))

	c.Assert(createdMenu.menuItems[7].(*accountMockCheckMenuItem).onActivate, Not(IsNil))
	c.Assert(createdMenu.menuItems[8].(*accountMockCheckMenuItem).onActivate, Not(IsNil))
}
开发者ID:rosatolen,项目名称:coyim,代码行数:23,代码来源:account_test.go


示例7: Test_createStatusMessage_createsStatusMessages

func (s *GUIXmppSuite) Test_createStatusMessage_createsStatusMessages(c *C) {
	i18n.InitLocalization(&glib_mock.Mock{})

	c.Assert(createStatusMessage("Foo", "", "", false), Equals, "Foo is now Available")

	c.Assert(createStatusMessage("Foo", "", "", true), Equals, "Foo is now Offline")
	c.Assert(createStatusMessage("Foo", "", "something happened", true), Equals, "Foo is now Offline (something happened)")
	c.Assert(createStatusMessage("Foo", "xa", "something happened", true), Equals, "Foo is now Offline (Not Available: something happened)")
	c.Assert(createStatusMessage("Foo", "xa", "", true), Equals, "Foo is now Offline (Not Available)")

	c.Assert(createStatusMessage("Foo", "xa", "something happened", false), Equals, "Foo is now Not Available (something happened)")

	c.Assert(createStatusMessage("Foo2", "dnd", "", false), Equals, "Foo2 is now Busy")
	c.Assert(createStatusMessage("Foo2", "dnd", "some stuff", false), Equals, "Foo2 is now Busy (some stuff)")

	c.Assert(createStatusMessage("Foo2", "chat", "", false), Equals, "Foo2 is now Free for Chat")
	c.Assert(createStatusMessage("Foo2", "chat", "really!", false), Equals, "Foo2 is now Free for Chat (really!)")

	c.Assert(createStatusMessage("Foo3", "away", "", false), Equals, "Foo3 is now Away")
	c.Assert(createStatusMessage("Foo3", "away", "wut", false), Equals, "Foo3 is now Away (wut)")

	c.Assert(createStatusMessage("Foo4", "invisible", "", false), Equals, "Foo4 is now Invisible")
	c.Assert(createStatusMessage("Foo4", "invisible", "wut", false), Equals, "Foo4 is now Invisible (wut)")
}
开发者ID:rosatolen,项目名称:coyim,代码行数:24,代码来源:conversation_test.go


示例8: Test_account_createSubmenu_setsActivationCorrectly

func (*AccountSuite) Test_account_createSubmenu_setsActivationCorrectly(c *C) {
	i18n.InitLocalization(&accountMockGlib{})
	g = Graphics{gtk: &accountMockGtk{}, glib: &accountDirectGlibIdleAddMock{}}

	sess := &accountMockSession{config: &config.Account{}}
	a := &account{session: sess}

	menu := a.createSubmenu()
	createdMenu := menu.(*accountMockMenu)

	// We can't really check that these things are set to the correct functions, just that they are set
	// It might be possible to try invoking them and see that they do the right things, at some point
	// For now, too much bother.

	c.Assert(createdMenu.GetMenuItemByName("Check Connection").onActivate, Not(IsNil))
	c.Assert(createdMenu.GetMenuItemByName("Connect").onActivate, Not(IsNil))
	c.Assert(createdMenu.GetMenuItemByName("Disconnect").onActivate, Not(IsNil))

	c.Assert(createdMenu.GetMenuItemByName("Edit").onActivate, Not(IsNil))
	c.Assert(createdMenu.GetMenuItemByName("Remove").onActivate, Not(IsNil))

	c.Assert(createdMenu.GetCheckMenuItemByName("Connect Automatically").onActivate, Not(IsNil))
	c.Assert(createdMenu.GetCheckMenuItemByName("Always Encrypt Conversation").onActivate, Not(IsNil))
}
开发者ID:twstrike,项目名称:coyim,代码行数:24,代码来源:account_test.go


示例9: init

func init() {
	log.SetOutput(ioutil.Discard)
	i18n.InitLocalization(&glib_mock.Mock{})
}
开发者ID:rosatolen,项目名称:coyim,代码行数:4,代码来源:mechanism_test.go


示例10: SetUpSuite

func (*TCPSuite) SetUpSuite(c *C) {
	log.SetOutput(ioutil.Discard)
	i18n.InitLocalization(&glib_mock.Mock{})
}
开发者ID:twstrike,项目名称:coyim,代码行数:4,代码来源:tcp_test.go



注:本文中的github.com/twstrike/coyim/i18n.InitLocalization函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang i18n.Local函数代码示例发布时间:2022-05-28
下一篇:
Golang v1.C类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap