Skip to content

Commit

Permalink
fix: Fix missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom5521 committed Nov 5, 2024
1 parent 3b371da commit f6c28fd
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 15 deletions.
36 changes: 36 additions & 0 deletions locales/po/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,39 @@ msgstr ""

msgid "%v files with %v errors"
msgstr ""

msgid "Name:"
msgstr ""

msgid "Size:"
msgstr ""

msgid "Absolute Path:"
msgstr ""

msgid "Modify:"
msgstr ""

msgid "Access:"
msgstr ""

msgid "Birth:"
msgstr ""

msgid "Is directory:"
msgstr ""

msgid "Permissions:"
msgstr ""

msgid "Number of files:"
msgstr ""

msgid "UID/Name:"
msgstr ""

msgid "GID/Group:"
msgstr ""

msgid "not supported on windows"
msgstr ""
35 changes: 35 additions & 0 deletions locales/po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,38 @@ msgstr "Contando la cantidad de archivos..."
msgid "%v files with %v errors"
msgstr "%v archivos con %v errores"

msgid "Name:"
msgstr "Nombre:"

msgid "Size:"
msgstr "Tamaño:"

msgid "Absolute Path:"
msgstr "Ruta absoluta:"

msgid "Modify:"
msgstr "Modificación:"

msgid "Access:"
msgstr "Acceso:"

msgid "Birth:"
msgstr "Creación:"

msgid "Is directory:"
msgstr "Es directorio:"

msgid "Permissions:"
msgstr "Permisos:"

msgid "Number of files:"
msgstr "Numero de archivos:"

msgid "UID/Name:"
msgstr "UID/Nombre:"

msgid "GID/Group:"
msgstr "GID/Grupo:"

msgid "not supported on windows"
msgstr "no compatible con windows"
35 changes: 35 additions & 0 deletions locales/po/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,38 @@ msgstr "Contando a quantidade de arquivos..."
msgid "%v files with %v errors"
msgstr "%v arquivos com %v erros"

msgid "Name:"
msgstr "Nome:"

msgid "Size:"
msgstr "Tamanho:"

msgid "Absolute Path:"
msgstr "Caminho Absoluto:"

msgid "Modify:"
msgstr "Modificar:"

msgid "Access:"
msgstr "Acesso:"

msgid "Birth:"
msgstr "Criação:"

msgid "Is directory:"
msgstr "É diretório:"

msgid "Permissions:"
msgstr "Permissões:"

msgid "Number of files:"
msgstr "Número de arquivos:"

msgid "UID/Name:"
msgstr "UID/Nome:"

msgid "GID/Group:"
msgstr "GID/Grupo:"

msgid "not supported on windows"
msgstr "não suportado no windows"
35 changes: 35 additions & 0 deletions locales/po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,38 @@ msgstr "Подсчет количества файлов..."
msgid "%v files with %v errors"
msgstr "%v файлов с %v ошибками"

msgid "Name:"
msgstr "Имя:"

msgid "Size:"
msgstr "Размер:"

msgid "Absolute Path:"
msgstr "Абсолютный путь:"

msgid "Modify:"
msgstr "Изменить:"

msgid "Access:"
msgstr "Доступ:"

msgid "Birth:"
msgstr "Создание:"

msgid "Is directory:"
msgstr "Это каталог:"

msgid "Permissions:"
msgstr "Разрешения:"

msgid "Number of files:"
msgstr "Количество файлов:"

msgid "UID/Name:"
msgstr "UID/Имя:"

msgid "GID/Group:"
msgstr "GID/Группа:"

msgid "not supported on windows"
msgstr "не поддерживается на windows"
31 changes: 19 additions & 12 deletions stat/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ import (
"github.com/Tom5521/fsize/checkos"
"github.com/Tom5521/fsize/filecount"
"github.com/Tom5521/fsize/flags"
"github.com/Tom5521/fsize/locales"
"github.com/gookit/color"
"github.com/labstack/gommon/bytes"
)

var ErrGettingStruct = errors.New("error getting the corresponding structure from fileinfo.Sys()")
var (
po = locales.Po
ErrGettingStruct = errors.New(
po.Get("error getting the corresponding structure from fileinfo.Sys()"),
)
ErrNotSupportedOnWindows = errors.New(po.Get("not supported on windows"))
)

type File struct {
FileTimes
Expand Down Expand Up @@ -106,23 +113,23 @@ func (f File) String() string {
fmt.Fprintln(&builder, content...)
}

render("Name:", f.Name)
render("Size:", bytes.New().Format(f.Size))
render("Absolute Path:", f.AbsPath)
render("Modify:", f.ModTime.Format(time.DateTime))
render("Access:", f.AccessTime.Format(time.DateTime))
render(po.Get("Name:"), f.Name)
render(po.Get("Size:"), bytes.New().Format(f.Size))
render(po.Get("Absolute Path:"), f.AbsPath)
render(po.Get("Modify:"), f.ModTime.Format(time.DateTime))
render(po.Get("Access:"), f.AccessTime.Format(time.DateTime))
if f.SupportCreationDate {
render("Birth:", f.CreationTime.Format(time.DateTime))
render(po.Get("Birth:"), f.CreationTime.Format(time.DateTime))
}
render("Is directory:", f.IsDir)
render("Permissions:", fmt.Sprintf("%v/%v", int(f.Perms), f.Perms.String()))
render(po.Get("Is directory:"), f.IsDir)
render(po.Get("Permissions:"), fmt.Sprintf("%v/%v", int(f.Perms), f.Perms.String()))
if f.IsDir && !flags.NoWalk {
render("Number of files:", f.FilesNumber)
render(po.Get("Number of files:"), f.FilesNumber)
}

if checkos.Unix {
render("UID/Name:", fmt.Sprintf("%v/%v", f.User.Uid, f.User.Username))
render("GID/Name:", fmt.Sprintf("%v/%v", f.Group.Gid, f.Group.Name))
render(po.Get("UID/Name:"), fmt.Sprintf("%v/%v", f.User.Uid, f.User.Username))
render(po.Get("GID/Group:"), fmt.Sprintf("%v/%v", f.Group.Gid, f.Group.Name))
}

return builder.String()
Expand Down
10 changes: 7 additions & 3 deletions stat/ids_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import (
"os/user"
)

func UsrAndGroup(info os.FileInfo) (usr *user.User, group *user.Group, err error) { return }
func UsrAndGroup(info os.FileInfo) (usr *user.User, group *user.Group, err error) {
return nil, nil, ErrNotSupportedOnWindows
}

func Usr(info os.FileInfo) (usr *user.User, err error) { return }
func Usr(info os.FileInfo) (usr *user.User, err error) {
return nil, ErrNotSupportedOnWindows
}

func Group(info os.FileInfo) (group *user.Group, err error) { return }
func Group(info os.FileInfo) (group *user.Group, err error) { return nil, ErrNotSupportedOnWindows }

0 comments on commit f6c28fd

Please sign in to comment.