Skip to content

Commit

Permalink
Merge pull request #26 from Sharrnah/UI-Translations
Browse files Browse the repository at this point in the history
UI translations
  • Loading branch information
Sharrnah authored Aug 20, 2024
2 parents 306909d + 283d06e commit d01d2ba
Show file tree
Hide file tree
Showing 46 changed files with 2,558 additions and 610 deletions.
15 changes: 10 additions & 5 deletions CustomWidget/Entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package CustomWidget
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/widget"
"runtime"
"strings"
Expand Down Expand Up @@ -77,16 +78,18 @@ func (e *EntryWithPopupMenu) TappedSecondary(pe *fyne.PointEvent) {
clipboard := fyne.CurrentApp().Driver().AllWindows()[0].Clipboard()
super := e.superWidget()

cutItem := fyne.NewMenuItem("Cut", func() {
//undoItem := fyne.NewMenuItem(lang.L("Undo"), e.Undo)
//redoItem := fyne.NewMenuItem(lang.L("Redo"), e.Redo)
cutItem := fyne.NewMenuItem(lang.L("Cut"), func() {
super.(fyne.Shortcutable).TypedShortcut(&fyne.ShortcutCut{Clipboard: clipboard})
})
copyItem := fyne.NewMenuItem("Copy", func() {
copyItem := fyne.NewMenuItem(lang.L("Copy"), func() {
super.(fyne.Shortcutable).TypedShortcut(&fyne.ShortcutCopy{Clipboard: clipboard})
})
pasteItem := fyne.NewMenuItem("Paste", func() {
pasteItem := fyne.NewMenuItem(lang.L("Paste"), func() {
super.(fyne.Shortcutable).TypedShortcut(&fyne.ShortcutPaste{Clipboard: clipboard})
})
selectAllItem := fyne.NewMenuItem("Select all", func() {
selectAllItem := fyne.NewMenuItem(lang.L("Select all"), func() {
super.(fyne.Shortcutable).TypedShortcut(&fyne.ShortcutSelectAll{})
})

Expand All @@ -100,7 +103,9 @@ func (e *EntryWithPopupMenu) TappedSecondary(pe *fyne.PointEvent) {
} else if e.Password {
menu = fyne.NewMenu("", pasteItem, selectAllItem)
} else {
menu = fyne.NewMenu("", cutItem, copyItem, pasteItem, selectAllItem)
var menuItems []*fyne.MenuItem
menuItems = append(menuItems, cutItem, copyItem, pasteItem, selectAllItem)
menu = fyne.NewMenu("", menuItems...)
}

// add additional menu items
Expand Down
13 changes: 8 additions & 5 deletions CustomWidget/HotKeyEntry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package CustomWidget

import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/widget"
"strings"
"sync"
Expand Down Expand Up @@ -64,16 +65,16 @@ func (e *HotKeyEntry) TappedSecondary(pe *fyne.PointEvent) {
clipboard := fyne.CurrentApp().Driver().AllWindows()[0].Clipboard()
super := e.superWidget()

cutItem := fyne.NewMenuItem("Cut", func() {
cutItem := fyne.NewMenuItem(lang.L("Cut"), func() {
super.(fyne.Shortcutable).TypedShortcut(&fyne.ShortcutCut{Clipboard: clipboard})
})
copyItem := fyne.NewMenuItem("Copy", func() {
copyItem := fyne.NewMenuItem(lang.L("Copy"), func() {
super.(fyne.Shortcutable).TypedShortcut(&fyne.ShortcutCopy{Clipboard: clipboard})
})
pasteItem := fyne.NewMenuItem("Paste", func() {
pasteItem := fyne.NewMenuItem(lang.L("Paste"), func() {
super.(fyne.Shortcutable).TypedShortcut(&fyne.ShortcutPaste{Clipboard: clipboard})
})
selectAllItem := fyne.NewMenuItem("Select all", func() {
selectAllItem := fyne.NewMenuItem(lang.L("Select all"), func() {
super.(fyne.Shortcutable).TypedShortcut(&fyne.ShortcutSelectAll{})
})

Expand All @@ -87,7 +88,9 @@ func (e *HotKeyEntry) TappedSecondary(pe *fyne.PointEvent) {
} else if e.Password {
menu = fyne.NewMenu("", pasteItem, selectAllItem)
} else {
menu = fyne.NewMenu("", cutItem, copyItem, pasteItem, selectAllItem)
var menuItems []*fyne.MenuItem
menuItems = append(menuItems, cutItem, copyItem, pasteItem, selectAllItem)
menu = fyne.NewMenu("", menuItems...)
}

// add additional menu items
Expand Down
3 changes: 2 additions & 1 deletion CustomWidget/List.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/widget"
"log"
)
Expand Down Expand Up @@ -45,7 +46,7 @@ func NewListWithData(data binding.DataList, createItem func() fyne.CanvasObject,
return l
}
func (t *List) TappedSecondary(pe *fyne.PointEvent) {
cutItem := fyne.NewMenuItem("Cut", func() {
cutItem := fyne.NewMenuItem(lang.L("Cut"), func() {
log.Println("CUTTED")
})

Expand Down
5 changes: 2 additions & 3 deletions CustomWidget/TappableSelect.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package CustomWidget

import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"sync"
)

const defaultPlaceHolder string = "(Select one)"

type TappableSelect struct {
widget.Select
popUp *widget.PopUpMenu
Expand All @@ -27,7 +26,7 @@ func NewSelect(options []string, changed func(string)) *TappableSelect {
s := &TappableSelect{}
s.OnChanged = changed
s.Options = options
s.PlaceHolder = defaultPlaceHolder
s.PlaceHolder = lang.L("(Select one)")

s.ExtendBaseWidget(s)
return s
Expand Down
3 changes: 2 additions & 1 deletion CustomWidget/TextValueSelect.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package CustomWidget

import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/widget"
)

Expand Down Expand Up @@ -33,7 +34,7 @@ func NewTextValueSelect(name string, options []TextValueOption, changed func(Tex
s.updateSelected(text)
}
s.Options = options
s.PlaceHolder = defaultPlaceHolder
s.PlaceHolder = lang.L("(Select one)")

if defaultIndex > -1 && defaultIndex <= len(s.Options) {
s.Selected = s.Options[defaultIndex].Text
Expand Down
Loading

0 comments on commit d01d2ba

Please sign in to comment.