当前位置: 首页>>代码示例>>Golang>>正文


Golang cdd.NewLocalizedString函数代码示例

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


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

示例1: convertPagesPerSheet

func convertPagesPerSheet(printerTags map[string][]string) *cdd.VendorCapability {
	numberUpSupported, exists := printerTags[attrNumberUpSupported]
	if !exists {
		return nil
	}

	c := cdd.VendorCapability{
		ID:                   attrNumberUp,
		Type:                 cdd.VendorCapabilitySelect,
		SelectCap:            &cdd.SelectCapability{},
		DisplayNameLocalized: cdd.NewLocalizedString("Pages per sheet"),
	}

	def, exists := printerTags[attrNumberUpDefault]
	if !exists {
		def = []string{"1"}
	}

	for _, number := range numberUpSupported {
		option := cdd.SelectCapabilityOption{
			Value:                number,
			IsDefault:            reflect.DeepEqual(number, def[0]),
			DisplayNameLocalized: cdd.NewLocalizedString(number),
		}
		c.SelectCap.Option = append(c.SelectCap.Option, option)
	}

	return &c
}
开发者ID:kleopatra999,项目名称:cups-connector,代码行数:29,代码来源:translate-attrs.go

示例2: TestGetVendorState

func TestGetVendorState(t *testing.T) {
	vs := getVendorState(nil)
	if nil != vs {
		t.Logf("expected nil")
		t.Fail()
	}

	pt := map[string][]string{}
	vs = getVendorState(pt)
	if nil != vs {
		t.Logf("expected nil")
		t.Fail()
	}

	pt = map[string][]string{
		attrPrinterStateReasons: []string{"broken-arrow", "peanut-butter-jam-warning"},
	}
	expected := &cdd.VendorState{
		Item: []cdd.VendorStateItem{
			cdd.VendorStateItem{
				DescriptionLocalized: cdd.NewLocalizedString("broken-arrow"),
				State:                cdd.VendorStateError,
			},
			cdd.VendorStateItem{
				DescriptionLocalized: cdd.NewLocalizedString("peanut-butter-jam-warning"),
				State:                cdd.VendorStateWarning,
			},
		},
	}
	vs = getVendorState(pt)
	if !reflect.DeepEqual(expected, vs) {
		t.Logf("expected\n %+v\ngot\n %+v", expected, vs)
		t.Fail()
	}
}
开发者ID:t-yuki,项目名称:cups-connector,代码行数:35,代码来源:translate-attrs_test.go

示例3: TestTrInputSlot

func TestTrInputSlot(t *testing.T) {
	ppd := `*PPD-Adobe: "4.3"
*OpenUI *OutputBin/Destination: PickOne
*OrderDependency: 210 AnySetup *OutputBin
*DefaultOutputBin: FinProof
*OutputBin Standard/Internal Tray 1: ""
*OutputBin Bin1/Internal Tray 2: ""
*OutputBin External/External Tray: ""
*CloseUI: *OutputBin`
	expected := &cdd.PrinterDescriptionSection{
		VendorCapability: &[]cdd.VendorCapability{
			cdd.VendorCapability{
				ID:                   "OutputBin",
				Type:                 cdd.VendorCapabilitySelect,
				DisplayNameLocalized: cdd.NewLocalizedString("Destination"),
				SelectCap: &cdd.SelectCapability{
					Option: []cdd.SelectCapabilityOption{
						cdd.SelectCapabilityOption{"Standard", "", true, cdd.NewLocalizedString("Internal Tray 1")},
						cdd.SelectCapabilityOption{"Bin1", "", false, cdd.NewLocalizedString("Internal Tray 2")},
						cdd.SelectCapabilityOption{"External", "", false, cdd.NewLocalizedString("External Tray")},
					},
				},
			},
		},
	}
	translationTest(t, ppd, expected)
}
开发者ID:tryandbuy,项目名称:cups-connector,代码行数:27,代码来源:translate-ppd_test.go

示例4: TestConvertColorAttrs

func TestConvertColorAttrs(t *testing.T) {
	c := convertColorAttrs(nil)
	if c != nil {
		t.Logf("expected nil")
		t.Fail()
	}

	pt := map[string][]string{}
	c = convertColorAttrs(pt)
	if c != nil {
		t.Logf("expected nil")
		t.Fail()
	}

	pt = map[string][]string{
		"print-color-mode-default":   []string{"auto"},
		"print-color-mode-supported": []string{"color", "monochrome", "auto", "zebra"},
	}
	expected := &cdd.Color{
		Option: []cdd.ColorOption{
			cdd.ColorOption{"print-color-mode:color", cdd.ColorTypeStandardColor, "", false, cdd.NewLocalizedString("Color")},
			cdd.ColorOption{"print-color-mode:monochrome", cdd.ColorTypeStandardMonochrome, "", false, cdd.NewLocalizedString("Monochrome")},
			cdd.ColorOption{"print-color-mode:auto", cdd.ColorTypeAuto, "", true, cdd.NewLocalizedString("Auto")},
			cdd.ColorOption{"print-color-mode:zebra", cdd.ColorTypeCustomColor, "", false, cdd.NewLocalizedString("zebra")},
		},
	}
	c = convertColorAttrs(pt)
	if !reflect.DeepEqual(expected, c) {
		t.Logf("expected %+v, got %+v", expected, c)
		t.Fail()
	}
}
开发者ID:t-yuki,项目名称:cups-connector,代码行数:32,代码来源:translate-attrs_test.go

示例5: TestTrPrintQuality

func TestTrPrintQuality(t *testing.T) {
	ppd := `*PPD-Adobe: "4.3"
*OpenUI *HPPrintQuality/Print Quality: PickOne
*DefaultHPPrintQuality: FastRes1200
*HPPrintQuality FastRes1200/FastRes 1200: ""
*HPPrintQuality 600dpi/600 dpi: ""
*HPPrintQuality ProRes1200/ProRes 1200: ""
*CloseUI: *HPPrintQuality`
	expected := &cdd.PrinterDescriptionSection{
		VendorCapability: &[]cdd.VendorCapability{
			cdd.VendorCapability{
				ID:                   "HPPrintQuality",
				Type:                 cdd.VendorCapabilitySelect,
				DisplayNameLocalized: cdd.NewLocalizedString("Print Quality"),
				SelectCap: &cdd.SelectCapability{
					Option: []cdd.SelectCapabilityOption{
						cdd.SelectCapabilityOption{"FastRes1200", "", true, cdd.NewLocalizedString("FastRes 1200")},
						cdd.SelectCapabilityOption{"600dpi", "", false, cdd.NewLocalizedString("600 dpi")},
						cdd.SelectCapabilityOption{"ProRes1200", "", false, cdd.NewLocalizedString("ProRes 1200")},
					},
				},
			},
		},
	}
	translationTest(t, ppd, expected)
}
开发者ID:tryandbuy,项目名称:cups-connector,代码行数:26,代码来源:translate-ppd_test.go

示例6: TestTrColor

func TestTrColor(t *testing.T) {
	ppd := `*PPD-Adobe: "4.3"
*OpenUI *ColorModel/Color Mode: PickOne
*DefaultColorModel: Gray
*ColorModel CMYK/Color: "(cmyk) RCsetdevicecolor"
*ColorModel Gray/Black and White: "(gray) RCsetdevicecolor"
*CloseUI: *ColorModel`
	expected := &cdd.PrinterDescriptionSection{
		Color: &cdd.Color{
			Option: []cdd.ColorOption{
				cdd.ColorOption{"ColorModel:CMYK", cdd.ColorTypeStandardColor, "", false, cdd.NewLocalizedString("Color")},
				cdd.ColorOption{"ColorModel:Gray", cdd.ColorTypeStandardMonochrome, "", true, cdd.NewLocalizedString("Black and White")},
			},
		},
	}
	translationTest(t, ppd, expected)

	ppd = `*PPD-Adobe: "4.3"
*OpenUI *CMAndResolution/Print Color as Gray: PickOne
*OrderDependency: 20 AnySetup *CMAndResolution
*DefaultCMAndResolution: CMYKImageRET3600
*CMAndResolution CMYKImageRET3600/Off: "
  <</ProcessColorModel /DeviceCMYK /HWResolution [600 600] /PreRenderingEnhance false >> setpagedevice"
*End
*CMAndResolution Gray600x600dpi/On: "
  <</ProcessColorModel /DeviceGray /HWResolution [600 600] >> setpagedevice"
*End
*CloseUI: *CMAndResolution
`
	expected = &cdd.PrinterDescriptionSection{
		Color: &cdd.Color{
			Option: []cdd.ColorOption{
				cdd.ColorOption{"CMAndResolution:CMYKImageRET3600", cdd.ColorTypeStandardColor, "", true, cdd.NewLocalizedString("Color")},
				cdd.ColorOption{"CMAndResolution:Gray600x600dpi", cdd.ColorTypeStandardMonochrome, "", false, cdd.NewLocalizedString("Gray")},
			},
		},
	}
	translationTest(t, ppd, expected)

	ppd = `*PPD-Adobe: "4.3"
*OpenUI *CMAndResolution/Print Color as Gray: PickOne
*OrderDependency: 20 AnySetup *CMAndResolution
*DefaultCMAndResolution: CMYKImageRET2400
*CMAndResolution CMYKImageRET2400/Off - ImageRET 2400: "<< /ProcessColorModel /DeviceCMYK /HWResolution [600 600]  >> setpagedevice"
*CMAndResolution Gray1200x1200dpi/On - ProRes 1200: "<</ProcessColorModel /DeviceGray /HWResolution [1200 1200] /PreRenderingEnhance false>> setpagedevice"
*CMAndResolution Gray600x600dpi/On - 600 dpi: "<</ProcessColorModel /DeviceGray /HWResolution [600 600] /PreRenderingEnhance false>> setpagedevice"
*CloseUI: *CMAndResolution
`
	expected = &cdd.PrinterDescriptionSection{
		Color: &cdd.Color{
			Option: []cdd.ColorOption{
				cdd.ColorOption{"CMAndResolution:CMYKImageRET2400", cdd.ColorTypeStandardColor, "", true, cdd.NewLocalizedString("Color, ImageRET 2400")},
				cdd.ColorOption{"CMAndResolution:Gray1200x1200dpi", cdd.ColorTypeCustomMonochrome, "", false, cdd.NewLocalizedString("Gray, ProRes 1200")},
				cdd.ColorOption{"CMAndResolution:Gray600x600dpi", cdd.ColorTypeCustomMonochrome, "", false, cdd.NewLocalizedString("Gray, 600 dpi")},
			},
		},
	}
	translationTest(t, ppd, expected)
}
开发者ID:jacobmarble,项目名称:cc-deb-pkg,代码行数:59,代码来源:translate-ppd_test.go

示例7: TestConvertPagesPerSheet

func TestConvertPagesPerSheet(t *testing.T) {
	vc := convertPagesPerSheet(nil)
	if vc != nil {
		t.Logf("expected nil")
		t.Fail()
	}

	pt := map[string][]string{}
	vc = convertPagesPerSheet(pt)
	if vc != nil {
		t.Logf("expected nil")
		t.Fail()
	}

	pt = map[string][]string{
		"number-up-default":   []string{"4"},
		"number-up-supported": []string{"1", "2", "4"},
	}
	expected := &cdd.VendorCapability{
		ID:   "number-up",
		Type: cdd.VendorCapabilitySelect,
		SelectCap: &cdd.SelectCapability{
			Option: []cdd.SelectCapabilityOption{
				cdd.SelectCapabilityOption{
					Value:                "1",
					IsDefault:            false,
					DisplayNameLocalized: cdd.NewLocalizedString("1"),
				},
				cdd.SelectCapabilityOption{
					Value:                "2",
					IsDefault:            false,
					DisplayNameLocalized: cdd.NewLocalizedString("2"),
				},
				cdd.SelectCapabilityOption{
					Value:                "4",
					IsDefault:            true,
					DisplayNameLocalized: cdd.NewLocalizedString("4"),
				},
			},
		},
		DisplayNameLocalized: cdd.NewLocalizedString("Pages per sheet"),
	}
	vc = convertPagesPerSheet(pt)
	if !reflect.DeepEqual(expected, vc) {
		e, _ := json.Marshal(expected)
		f, _ := json.Marshal(vc)
		t.Logf("expected\n %s\ngot\n %s", e, f)
		t.Fail()
	}
}
开发者ID:t-yuki,项目名称:cups-connector,代码行数:50,代码来源:translate-attrs_test.go

示例8: convertColorAttrs

func convertColorAttrs(printerTags map[string][]string) *cdd.Color {
	colorSupported, exists := printerTags[attrPrintColorModeSupported]
	if !exists {
		return nil
	}

	colorDefault, exists := printerTags[attrPrintColorModeDefault]
	if !exists || len(colorDefault) != 1 {
		colorDefault = colorSupported[:1]
	}

	var c cdd.Color
	for _, color := range colorSupported {
		var co cdd.ColorOption
		var exists bool
		if co, exists = colorByKeyword[color]; !exists {
			co = cdd.ColorOption{
				VendorID: fmt.Sprintf("%s%s%s", attrPrintColorMode, internalKeySeparator, color),
				Type:     cdd.ColorTypeCustomColor,
				CustomDisplayNameLocalized: cdd.NewLocalizedString(color),
			}
		}
		if color == colorDefault[0] {
			co.IsDefault = true
		}
		c.Option = append(c.Option, co)
	}

	return &c
}
开发者ID:TechEdge01,项目名称:cups-connector,代码行数:30,代码来源:translate-attrs.go

示例9: TestTrColor

func TestTrColor(t *testing.T) {
	ppd := `*PPD-Adobe: "4.3"
*OpenUI *ColorModel/Color Mode: PickOne
*DefaultColorModel: Gray
*ColorModel CMYK/Color: "(cmyk) RCsetdevicecolor"
*ColorModel Gray/Black and White: "(gray) RCsetdevicecolor"
*CloseUI: *ColorModel`
	expected := &cdd.PrinterDescriptionSection{
		Color: &cdd.Color{
			Option: []cdd.ColorOption{
				cdd.ColorOption{"ColorModelCMYK", cdd.ColorTypeStandardColor, "", false, cdd.NewLocalizedString("Color")},
				cdd.ColorOption{"ColorModelGray", cdd.ColorTypeStandardMonochrome, "", true, cdd.NewLocalizedString("Black and White")},
			},
		},
	}
	translationTest(t, ppd, expected)
}
开发者ID:kleopatra999,项目名称:cups-connector,代码行数:17,代码来源:translate-ppd_test.go

示例10: TestTrDPI

func TestTrDPI(t *testing.T) {
	ppd := `*PPD-Adobe: "4.3"
*OpenUI *Resolution/Resolution: PickOne
*DefaultResolution: 600dpi
*Resolution 600dpi/600 dpi: ""
*Resolution 1200x600dpi/1200x600 dpi: ""
*Resolution 1200x1200dpi/1200 dpi: ""
*CloseUI: *Resolution`
	expected := &cdd.PrinterDescriptionSection{
		DPI: &cdd.DPI{
			Option: []cdd.DPIOption{
				cdd.DPIOption{600, 600, true, "", "600dpi", cdd.NewLocalizedString("600 dpi")},
				cdd.DPIOption{1200, 600, false, "", "1200x600dpi", cdd.NewLocalizedString("1200x600 dpi")},
				cdd.DPIOption{1200, 1200, false, "", "1200x1200dpi", cdd.NewLocalizedString("1200 dpi")},
			},
		},
	}
	translationTest(t, ppd, expected)
}
开发者ID:tryandbuy,项目名称:cups-connector,代码行数:19,代码来源:translate-ppd_test.go

示例11: GetCovers

func (vs *VariableSet) GetCovers() (*[]cdd.Cover, *cdd.CoverState, bool) {
	descriptions := vs.GetSubtree(PrinterCoverDescription).Variables()
	statuses := vs.GetSubtree(PrinterCoverStatus).Variables()

	if len(descriptions) < 1 ||
		len(descriptions) != len(statuses) {
		return nil, nil, false
	}

	covers := make([]cdd.Cover, 0, len(descriptions))
	coverState := cdd.CoverState{make([]cdd.CoverStateItem, 0, len(statuses))}

	for i := 0; i < len(descriptions); i++ {
		index := cdd.NewSchizophrenicInt64(descriptions[i].Name[len(descriptions[i].Name)-1])
		description := descriptions[i].Value
		state := PrinterCoverStatusToGCP[statuses[i].Value]
		cover := cdd.Cover{
			VendorID: index.String(),
			Index:    index,
		}

		switch strings.ToLower(description) {
		case "cover":
			cover.Type = cdd.CoverTypeCover
		case "door":
			cover.Type = cdd.CoverTypeDoor
		default:
			cover.Type = cdd.CoverTypeCustom
			cover.CustomDisplayNameLocalized = cdd.NewLocalizedString(description)
		}
		covers = append(covers, cover)

		coverStateItem := cdd.CoverStateItem{
			VendorID: index.String(),
			State:    state,
		}
		if state == cdd.CoverStateFailure {
			coverStateItem.VendorMessage = PrinterCoverStatusTC[statuses[i].Value]
		}
		coverState.Item = append(coverState.Item, coverStateItem)
	}

	return &covers, &coverState, true
}
开发者ID:t-yuki,项目名称:cups-connector,代码行数:44,代码来源:printmib.go

示例12: TestRicohLockedPrint

func TestRicohLockedPrint(t *testing.T) {
	ppd := `*PPD-Adobe: "4.3"
*OpenUI *JobType/JobType: PickOne
*FoomaticRIPOption JobType: enum CmdLine B
*OrderDependency: 255 AnySetup *JobType
*DefaultJobType: Normal
*JobType Normal/Normal: "%% FoomaticRIPOptionSetting: JobType=Normal"
*JobType SamplePrint/Sample Print: "%% FoomaticRIPOptionSetting: JobType=SamplePrint"
*JobType LockedPrint/Locked Print: ""
*JobType DocServer/Document Server: ""
*CloseUI: *JobType

*OpenUI *LockedPrintPassword/Locked Print Password (4-8 digits): PickOne
*FoomaticRIPOption LockedPrintPassword: password CmdLine C
*FoomaticRIPOptionMaxLength LockedPrintPassword:8
*FoomaticRIPOptionAllowedChars LockedPrintPassword: "0-9"
*OrderDependency: 255 AnySetup *LockedPrintPassword
*DefaultLockedPrintPassword: None
*LockedPrintPassword None/None: ""
*LockedPrintPassword 4001/4001: "%% FoomaticRIPOptionSetting: LockedPrintPassword=4001"
*LockedPrintPassword 4002/4002: "%% FoomaticRIPOptionSetting: LockedPrintPassword=4002"
*LockedPrintPassword 4003/4003: "%% FoomaticRIPOptionSetting: LockedPrintPassword=4003"
*CloseUI: *LockedPrintPassword

*CustomLockedPrintPassword True/Custom Password: ""
*ParamCustomLockedPrintPassword Password: 1 passcode 4 8
`
	expected := &cdd.PrinterDescriptionSection{
		VendorCapability: &[]cdd.VendorCapability{
			cdd.VendorCapability{
				ID:                   "JobType:LockedPrint/LockedPrintPassword",
				Type:                 cdd.VendorCapabilityTypedValue,
				DisplayNameLocalized: cdd.NewLocalizedString("Password (4 numbers)"),
				TypedValueCap: &cdd.TypedValueCapability{
					ValueType: cdd.TypedValueCapabilityTypeString,
				},
			},
		},
	}
	translationTest(t, ppd, expected)
}
开发者ID:tryandbuy,项目名称:cups-connector,代码行数:41,代码来源:translate-ppd_test.go

示例13: convertColorAttrs

func convertColorAttrs(printerTags map[string][]string) *cdd.Color {
	colorSupported, exists := printerTags[attrPrintColorModeSupported]
	if !exists {
		return nil
	}

	colorDefault, exists := printerTags[attrPrintColorModeDefault]
	if !exists || len(colorDefault) != 1 {
		colorDefault = colorSupported[:1]
	}

	var c cdd.Color
	for _, color := range colorSupported {
		var co cdd.ColorOption
		var exists bool
		if co, exists = colorByKeyword[color]; !exists {
			co = cdd.ColorOption{
				VendorID: color,
				Type:     cdd.ColorTypeCustomColor,
				CustomDisplayNameLocalized: cdd.NewLocalizedString(color),
			}
		}
		if color == colorDefault[0] {
			co.IsDefault = true
		}
		c.Option = append(c.Option, co)
	}

	for i := range c.Option {
		// Color can be specified by either attribute or PPD.
		// Therefore, prepend "ColorModel" to these ColorOptions.
		c.Option[i].VendorID = attrPrintColorMode + c.Option[i].VendorID
	}

	return &c
}
开发者ID:kleopatra999,项目名称:cups-connector,代码行数:36,代码来源:translate-attrs.go

示例14: getVendorState

func getVendorState(printerTags map[string][]string) *cdd.VendorState {
	reasons, exists := printerTags[attrPrinterStateReasons]
	if !exists || len(reasons) < 1 {
		return nil
	}

	sort.Strings(reasons)
	vendorState := &cdd.VendorState{Item: make([]cdd.VendorStateItem, len(reasons))}
	for i, reason := range reasons {
		vs := cdd.VendorStateItem{DescriptionLocalized: cdd.NewLocalizedString(reason)}
		if strings.HasSuffix(reason, "-error") {
			vs.State = cdd.VendorStateError
		} else if strings.HasSuffix(reason, "-warning") {
			vs.State = cdd.VendorStateWarning
		} else if strings.HasSuffix(reason, "-report") {
			vs.State = cdd.VendorStateInfo
		} else {
			vs.State = cdd.VendorStateError
		}
		vendorState.Item[i] = vs
	}

	return vendorState
}
开发者ID:kleopatra999,项目名称:cups-connector,代码行数:24,代码来源:translate-attrs.go

示例15: convertPrinterState

func convertPrinterState(wsStatus uint32) *cdd.PrinterStateSection {
	state := cdd.PrinterStateSection{
		State:       cdd.CloudDeviceStateIdle,
		VendorState: &cdd.VendorState{},
	}

	if wsStatus&(PRINTER_STATUS_PRINTING|PRINTER_STATUS_PROCESSING) != 0 {
		state.State = cdd.CloudDeviceStateProcessing
	}

	if wsStatus&PRINTER_STATUS_PAUSED != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateWarning,
			DescriptionLocalized: cdd.NewLocalizedString("printer paused"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_ERROR != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateError,
			DescriptionLocalized: cdd.NewLocalizedString("printer error"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_PENDING_DELETION != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateError,
			DescriptionLocalized: cdd.NewLocalizedString("printer is being deleted"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_PAPER_JAM != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateError,
			DescriptionLocalized: cdd.NewLocalizedString("paper jam"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_PAPER_OUT != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateError,
			DescriptionLocalized: cdd.NewLocalizedString("paper out"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_MANUAL_FEED != 0 {
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateInfo,
			DescriptionLocalized: cdd.NewLocalizedString("manual feed mode"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_PAPER_PROBLEM != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateError,
			DescriptionLocalized: cdd.NewLocalizedString("paper problem"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_OFFLINE != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateError,
			DescriptionLocalized: cdd.NewLocalizedString("printer is offline"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_IO_ACTIVE != 0 {
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateInfo,
			DescriptionLocalized: cdd.NewLocalizedString("active I/O state"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_BUSY != 0 {
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateInfo,
			DescriptionLocalized: cdd.NewLocalizedString("busy"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_OUTPUT_BIN_FULL != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateError,
			DescriptionLocalized: cdd.NewLocalizedString("output bin is full"),
		}
		state.VendorState.Item = append(state.VendorState.Item, vs)
	}
	if wsStatus&PRINTER_STATUS_NOT_AVAILABLE != 0 {
		state.State = cdd.CloudDeviceStateStopped
		vs := cdd.VendorStateItem{
			State:                cdd.VendorStateError,
			DescriptionLocalized: cdd.NewLocalizedString("printer not available"),
//.........这里部分代码省略.........
开发者ID:tryandbuy,项目名称:cups-connector,代码行数:101,代码来源:winspool.go


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