本文整理汇总了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)
}
示例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")
}
示例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()
}
示例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)
}
示例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 })
}
示例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))
}
示例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)")
}
示例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))
}
示例9: init
func init() {
log.SetOutput(ioutil.Discard)
i18n.InitLocalization(&glib_mock.Mock{})
}
示例10: SetUpSuite
func (*TCPSuite) SetUpSuite(c *C) {
log.SetOutput(ioutil.Discard)
i18n.InitLocalization(&glib_mock.Mock{})
}