converter

package
v0.0.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewForm

func NewForm() *ui.Form

NewForm is a unit converter in English, Russian and Chinese, switched live. The category is chosen with RadioButtons, the units with ComboBoxes; the two NumBoxes convert into each other, a Slider sets the precision and a Checkbox the thousands separators; a Table shows the value in every unit of the category (with a ContextMenu to copy it), and an EditableComboBox finds a unit in any category. All the texts come from the i18n catalog in strings.go: SetTextFunc, SetTitleFunc, SetTooltipFunc and SetHintFunc for the widgets' own texts, SetOnLanguageChanged for the rest.

Types

type CategoryStrings

type CategoryStrings struct {
	Length      string
	Area        string
	Volume      string
	Mass        string
	Temperature string
	Speed       string
	Data        string
}

type Strings

type Strings struct {
	Title       string
	Category    string
	Conversion  string
	Swap        string
	Precision   string
	PrecisionTT string
	Thousands   string
	ThousandsTT string
	CommonTitle string
	CommonTT    string
	ColumnUnit  string
	ColumnValue string
	Search      string
	SearchHint  string
	SearchTT    string
	Language    string
	CopyValue   string
	ConvertTo   string

	// How numbers are written
	DecimalSeparator   string
	ThousandsSeparator string

	Categories CategoryStrings
	Units      UnitStrings
}

Strings are all the texts of the converter, a value per language.

func T

func T() *Strings

T returns the texts in the language of the application.

type UnitName

type UnitName struct {
	Name   string
	Symbol string
}

UnitName is the name of a unit and its symbol, which some languages write in their own script.

type UnitStrings

type UnitStrings struct {
	Millimetre, Centimetre, Metre, Kilometre, Inch, Foot, Yard, Mile, NauticalMile            UnitName
	SquareCentimetre, SquareMetre, Hectare, SquareKilometre, SquareFoot, Acre, SquareMile     UnitName
	Millilitre, Litre, CubicMetre, FluidOunce, Cup, GallonUS, GallonUK                        UnitName
	Milligram, Gram, Kilogram, Tonne, Ounce, Pound, Stone                                     UnitName
	Celsius, Fahrenheit, Kelvin                                                               UnitName
	MetrePerSecond, KilometrePerHour, MilePerHour, Knot, FootPerSecond                        UnitName
	Bit, Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Kibibyte, Mebibyte, Gibibyte, Tebibyte UnitName
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL