Rename package

This commit is contained in:
Trevor Slocum 2024-07-21 23:33:57 -07:00
parent 7911f2a8a9
commit 6067ad4d7a
21 changed files with 44 additions and 47 deletions

View file

@ -29,7 +29,7 @@ jobs:
run: go build -v .
- name: Install xgotext CLI
run: go install -v github.com/leonelquinteros/gotext/cli/xgotext
run: go install -v code.rocket9labs.com/tslocum/gotext/cli/xgotext
- name: Test
run: go test -v -race ./...

View file

@ -1,13 +1,13 @@
[![GitHub release](https://img.shields.io/github/release/leonelquinteros/gotext.svg)](https://github.com/leonelquinteros/gotext)
[![GitHub release](https://img.shields.io/github/release/leonelquinteros/gotext.svg)](https://code.rocket9labs.com/tslocum/gotext)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
![Gotext build](https://github.com/leonelquinteros/gotext/workflows/Gotext%20build/badge.svg?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/leonelquinteros/gotext)](https://goreportcard.com/report/github.com/leonelquinteros/gotext)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/leonelquinteros/gotext)](https://pkg.go.dev/github.com/leonelquinteros/gotext)
![Gotext build](https://code.rocket9labs.com/tslocum/gotext/workflows/Gotext%20build/badge.svg?branch=master)
[![Go Report Card](https://goreportcard.com/badge/code.rocket9labs.com/tslocum/gotext)](https://goreportcard.com/report/code.rocket9labs.com/tslocum/gotext)
[![PkgGoDev](https://pkg.go.dev/badge/code.rocket9labs.com/tslocum/gotext)](https://pkg.go.dev/code.rocket9labs.com/tslocum/gotext)
# Gotext (Fork)
**Note:** This package is a fork of https://github.com/leonelquinteros/gotext with the following changes:
**Note:** This package is a fork of https://code.rocket9labs.com/tslocum/gotext with the following changes:
- Add flag `--no-locations`
- Remove usage of gob
@ -44,13 +44,13 @@ The original README follows.
# Documentation
Refer to the Godoc package documentation at (https://godoc.org/github.com/leonelquinteros/gotext)
Refer to the Godoc package documentation at (https://godoc.org/code.rocket9labs.com/tslocum/gotext)
# Installation
```
go get github.com/leonelquinteros/gotext
go get code.rocket9labs.com/tslocum/gotext
```
- There are no requirements or dependencies to use this package.
@ -64,17 +64,17 @@ Stable releases use [semantic versioning](http://semver.org/spec/v2.0.0.html) ta
You can rely on this to use your preferred vendoring tool or to manually retrieve the corresponding release tag from the GitHub repository.
**NOTE:** v1.5.0 contains a breaking change on how `Po` objects are initialised, see (https://github.com/leonelquinteros/gotext/issues/56)
**NOTE:** v1.5.0 contains a breaking change on how `Po` objects are initialised, see (https://code.rocket9labs.com/tslocum/gotext/issues/56)
### Vendoring with [Go Modules](https://github.com/golang/go/wiki/Modules) (Recommended)
Add `github.com/leonelquinteros/gotext` inside the `require` section in your `go.mod` file.
Add `code.rocket9labs.com/tslocum/gotext` inside the `require` section in your `go.mod` file.
i.e.
```
require (
github.com/leonelquinteros/gotext v1.4.0
code.rocket9labs.com/tslocum/gotext v1.4.0
)
```
@ -151,7 +151,7 @@ For quick/simple translations you can use the package level functions directly.
```go
import (
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {
@ -175,7 +175,7 @@ Use the fmt.Printf syntax (from Go's "fmt" package) to specify how to print the
```go
import (
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {
@ -200,7 +200,7 @@ so you can handle each settings on their own.
```go
import (
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {
@ -237,7 +237,7 @@ you can directly use the Po object to parse it and access the translations in th
```go
import (
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {
@ -271,7 +271,7 @@ as defined in (https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_no
```go
import (
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {

View file

@ -5,7 +5,7 @@ CLI tool to extract translation strings from Go packages into .POT files.
## Installation
```
go install github.com/leonelquinteros/gotext/cli/xgotext
go install code.rocket9labs.com/tslocum/gotext/cli/xgotext
```
## Usage

View file

@ -4,9 +4,9 @@ import (
"errors"
"fmt"
"github.com/leonelquinteros/gotext"
alias "github.com/leonelquinteros/gotext"
"github.com/leonelquinteros/gotext/cli/xgotext/fixtures/pkg"
"code.rocket9labs.com/tslocum/gotext"
alias "code.rocket9labs.com/tslocum/gotext"
"code.rocket9labs.com/tslocum/gotext/cli/xgotext/fixtures/pkg"
)
// Fake object with methods similar to gotext

View file

@ -1,6 +1,6 @@
package pkg
import "github.com/leonelquinteros/gotext"
import "code.rocket9labs.com/tslocum/gotext"
type SubTranslate struct {
L gotext.Locale

View file

@ -5,9 +5,9 @@ import (
"log"
"strings"
"github.com/leonelquinteros/gotext/cli/xgotext/parser"
"github.com/leonelquinteros/gotext/cli/xgotext/parser/dir"
pkg_tree "github.com/leonelquinteros/gotext/cli/xgotext/parser/pkg-tree"
"code.rocket9labs.com/tslocum/gotext/cli/xgotext/parser"
"code.rocket9labs.com/tslocum/gotext/cli/xgotext/parser/dir"
pkg_tree "code.rocket9labs.com/tslocum/gotext/cli/xgotext/parser/pkg-tree"
)
var (

View file

@ -11,7 +11,7 @@ import (
"golang.org/x/tools/go/packages"
"github.com/leonelquinteros/gotext/cli/xgotext/parser"
"code.rocket9labs.com/tslocum/gotext/cli/xgotext/parser"
)
// GetterDef describes a getter
@ -167,7 +167,7 @@ func (g *GoFile) checkType(rawType types.Type) bool {
return g.checkType(t.Elem())
case *types.Named:
if t.Obj().Pkg() == nil || t.Obj().Pkg().Path() != "github.com/leonelquinteros/gotext" {
if t.Obj().Pkg() == nil || t.Obj().Pkg().Path() != "code.rocket9labs.com/tslocum/gotext" {
return false
}
default:
@ -189,7 +189,7 @@ func (g *GoFile) inspectCallExpr(n *ast.CallExpr) {
// object is a package if the Obj is not set
if e.Obj == nil {
pkg, ok := g.importedPackages[e.Name]
if !ok || pkg.PkgPath != "github.com/leonelquinteros/gotext" {
if !ok || pkg.PkgPath != "code.rocket9labs.com/tslocum/gotext" {
return
}

View file

@ -6,7 +6,7 @@ import (
"path/filepath"
"strings"
"github.com/leonelquinteros/gotext/cli/xgotext/parser"
"code.rocket9labs.com/tslocum/gotext/cli/xgotext/parser"
)
// ParseDirFunc parses one directory

View file

@ -5,17 +5,18 @@ import (
"go/ast"
"go/token"
"go/types"
"golang.org/x/tools/go/packages"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/leonelquinteros/gotext/cli/xgotext/parser"
"golang.org/x/tools/go/packages"
"code.rocket9labs.com/tslocum/gotext/cli/xgotext/parser"
)
const gotextPkgPath = "github.com/leonelquinteros/gotext"
const gotextPkgPath = "code.rocket9labs.com/tslocum/gotext"
type GetterDef struct {
Id int
@ -60,7 +61,6 @@ func ParsePkgTree(pkgPath string, data *parser.DomainMap, verbose bool) error {
return pkgParser(pkgPath, basePath, data, verbose)
}
func pkgParser(dirPath, basePath string, data *parser.DomainMap, verbose bool) error {
mainPkg, err := loadPackage(dirPath)
if err != nil {
@ -141,7 +141,6 @@ func filterPkgsRec(pkg *packages.Package) []*packages.Package {
return result
}
// GoFile handles the parsing of one go file
type GoFile struct {
filePath string
@ -311,5 +310,3 @@ func (g *GoFile) parseGetter(def GetterDef, args []*ast.BasicLit, pos string) {
g.data.AddTranslation(domain, &trans)
}

View file

@ -5,7 +5,7 @@ import (
"path/filepath"
"testing"
"github.com/leonelquinteros/gotext/cli/xgotext/parser"
"code.rocket9labs.com/tslocum/gotext/cli/xgotext/parser"
)
func TestParsePkgTree(t *testing.T) {

View file

@ -9,7 +9,7 @@ import (
"strings"
"sync"
"github.com/leonelquinteros/gotext/plurals"
"code.rocket9labs.com/tslocum/gotext/plurals"
)
// Domain has all the common functions for dealing with a gettext domain

2
go.mod
View file

@ -1,4 +1,4 @@
module github.com/leonelquinteros/gotext
module code.rocket9labs.com/tslocum/gotext
// go: no requirements found in Gopkg.lock

View file

@ -5,7 +5,7 @@ For quick/simple translations you can use the package level functions directly.
import (
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {

View file

@ -22,7 +22,7 @@ Example:
import (
"bytes"
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {

2
mo.go
View file

@ -32,7 +32,7 @@ Example:
import (
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {

View file

@ -1,6 +1,6 @@
// Original work Copyright (c) 2016 Jonas Obrist (https://github.com/ojii/gettext.go)
// Modified work Copyright (c) 2018 DeineAgentur UG https://www.deineagentur.com
// Modified work Copyright (c) 2018-present gotext maintainers (https://github.com/leonelquinteros/gotext)
// Modified work Copyright (c) 2018-present gotext maintainers (https://code.rocket9labs.com/tslocum/gotext)
//
// Licensed under the 3-Clause BSD License. See LICENSE in the project root for license information.

View file

@ -1,6 +1,6 @@
// Original work Copyright (c) 2016 Jonas Obrist (https://github.com/ojii/gettext.go)
// Modified work Copyright (c) 2018 DeineAgentur UG https://www.deineagentur.com
// Modified work Copyright (c) 2018-present gotext maintainers (https://github.com/leonelquinteros/gotext)
// Modified work Copyright (c) 2018-present gotext maintainers (https://code.rocket9labs.com/tslocum/gotext)
//
// Licensed under the 3-Clause BSD License. See LICENSE in the project root for license information.

View file

@ -1,6 +1,6 @@
// Original work Copyright (c) 2016 Jonas Obrist (https://github.com/ojii/gettext.go)
// Modified work Copyright (c) 2018 DeineAgentur UG https://www.deineagentur.com
// Modified work Copyright (c) 2018-present gotext maintainers (https://github.com/leonelquinteros/gotext)
// Modified work Copyright (c) 2018-present gotext maintainers (https://code.rocket9labs.com/tslocum/gotext)
//
// Licensed under the 3-Clause BSD License. See LICENSE in the project root for license information.

View file

@ -1,6 +1,6 @@
// Original work Copyright (c) 2016 Jonas Obrist (https://github.com/ojii/gettext.go)
// Modified work Copyright (c) 2018 DeineAgentur UG https://www.deineagentur.com
// Modified work Copyright (c) 2018-present gotext maintainers (https://github.com/leonelquinteros/gotext)
// Modified work Copyright (c) 2018-present gotext maintainers (https://code.rocket9labs.com/tslocum/gotext)
//
// Licensed under the 3-Clause BSD License. See LICENSE in the project root for license information.

View file

@ -1,6 +1,6 @@
// Original work Copyright (c) 2016 Jonas Obrist (https://github.com/ojii/gettext.go)
// Modified work Copyright (c) 2018 DeineAgentur UG https://www.deineagentur.com
// Modified work Copyright (c) 2018-present gotext maintainers (https://github.com/leonelquinteros/gotext)
// Modified work Copyright (c) 2018-present gotext maintainers (https://code.rocket9labs.com/tslocum/gotext)
//
// Licensed under the BSD License. See License.txt in the project root for license information.

2
po.go
View file

@ -20,7 +20,7 @@ Example:
import (
"fmt"
"github.com/leonelquinteros/gotext"
"code.rocket9labs.com/tslocum/gotext"
)
func main() {