lokalise / go-lokalise-api Goto Github PK
View Code? Open in Web Editor NEWLokalise API v2 Golang client library.
Home Page: https://developers.lokalise.com/reference/lokalise-rest-api
License: Other
Lokalise API v2 Golang client library.
Home Page: https://developers.lokalise.com/reference/lokalise-rest-api
License: Other
Documentation: https://lokalise.co/api2docs/go/#resource-keys
Endpoints
Documentation: https://lokalise.co/api2docs/curl/#resource-files
Endpoints
Describe the bug
When retrieving translations instead of the string literal &
I am getting the unicode \u0026
back.
This is only for the &
character:
To Reproduce
Have a translation with the character &
. Retrieve translations with github.com/lokalise/go-lokalise-api/v3. The expected &
character is replaced with \u0026
.
Expected behavior
The &
character is returned, not the unicode.
Your environment:
go 1.17
Additional context
This works with our existing node script written in javascript as expected. I can retrieve the &
just fine. We are working to update for the upcoming pageLimit of 500 and converting to use Go and this was discovered.
Documentation: https://lokalise.co/api2docs/go/#resource-team-users
Endpoints
Documentation: https://lokalise.co/api2docs/go/#resource-screenshots
Endpoints
Get a basis request mapping in place used for all endpoints. A light wrapping of the resty library should make this straight forward.
It should be able to handle authentication and pagination by default. A custom wrapping of errors might be useful as well.
Client
A Client
should be exposed with configuration of timeouts, authentication tokens and base URL.
We can expose top-level functions that use a default client to allow simple use cases where default values are ok. (Like encoding/json
exposing function json.Marshal()
and json.NewEncoder()
)
Authentication (https://lokalise.co/api2docs/go/#resource-authentication)
Set header X-Api-Token
with the API token.
Pagination (https://lokalise.co/api2docs/go/#resource-pagination)
Expose limit
and page
options for list requests and expose X-Pagination-Total-Count
and X-Pagination-Page-Count
values in result sets.
Errors (https://lokalise.co/api2docs/go/#resource-errors)
The error object holds the HTTP status code and a human readable message.
{
"code": 400,
"message": "This key name is already taken"
}
Logging
It should be possible to register an io.Writer
for custom logging implementations. By default we can write to os.Stderr
.
Maybe also an option to log all requests for debugging purposes. Like a request and response logger.
Retry mechanism
All requests should be tried maximum 3 times by default (configurable with a client option). Retries should only happen on timeouts (not context cancelation), network errors and 5xx
responses.
Context cancelation
All endpoints should take a context.Context
as first argument to facilitate request cancelation by default. This lets clients opt out by using context.Background()
but forces them to think about it.
Documentation: https://lokalise.co/api2docs/go/#resource-snapshots
Endpoints
Describe the bug
As the major version tag is bumped to v4, module path in go.mod should be updated to v4.
Line 1 in 502c2e3
When trying to upgrade with go get
:
$ go get github.com/lokalise/[email protected]
go: github.com/lokalise/[email protected]: invalid version: go.mod has post-v4 module path "github.com/lokalise/go-lokalise-api/v3" at revision v4.0.0
When manually set require
as github.com/lokalise/go-lokalise-api/v3 v4.0.0
in my(importing) go.mod:
$ go get
go: errors parsing go.mod:
/.../my-project/go.mod:14:2: require github.com/lokalise/go-lokalise-api/v3: version "v4.0.0" invalid: should be v3, not v4
When set github.com/lokalise/go-lokalise-api/v4 v4.0.0
:
$ go get
go: github.com/lokalise/go-lokalise-api/[email protected]: go.mod has non-.../v4 module path "github.com/lokalise/go-lokalise-api/v3" (and .../v4/go.mod does not exist) at revision v4.0.0
Setting up from new, empty project:
$ go get github.com/lokalise/go-lokalise-api
go: github.com/lokalise/go-lokalise-api: no matching versions for query "upgrade"
To Reproduce
Try upgrading to v4 in existing project, or install newly:
mkdir temp && cd temp
go mod init temp
go get github.com/lokalise/go-lokalise-api
Expected behavior
It should upgrade to v4 well.
Your environment:
darwin/arm64 go1.19.5 and go1.21.3
Additional context
Describe the bug
Update method does not correspond to what is stated in the API: https://app.lokalise.com/api2docs/curl/#
Request URL:
PUT https://api.lokalise.com/api2/projects/{project_id:branch}/translations/{translation_id}
Request Body:
{
"translation": "Quick brown fox jumps over the lazy dog.",
"is_unverified": false,
"is_reviewed": true
}
But there is no is_unverified
flag in go-lokalise client, there is an is_fuzzy
flag instead:
type UpdateTranslation struct {
Translation string `json:"translation"`
IsFuzzy *bool `json:"is_fuzzy,omitempty"`
IsReviewed bool `json:"is_reviewed,omitempty"`
CustomTranslationStatusIDs []string `json:"custom_translation_status_ids,omitempty"`
}
To Reproduce
import github.com/lokalise/go-lokalise-api/v3
_, err := localiseClient.Translations().Update(projectID, translationID, lokalise.UpdateTranslation{
Translation: translation,
IsReviewed: IsUnverified,
})
Expected behavior
import github.com/lokalise/go-lokalise-api/v3
_, err := localiseClient.Translations().Update(projectID, translationID, lokalise.UpdateTranslation{
Translation: translation,
IsUnverified: IsUnverified, <-- there
})
Your environment:
Additional context
Is it possible to update go-lokalise library for current version of the Lokalise API?
Documentation: https://lokalise.co/api2docs/go/#resource-languages
Endpoints
Documentation: https://lokalise.co/api2docs/go/#resource-comments
Endpoints
Documentation: https://lokalise.co/api2docs/curl/#resource-projects
Endpoints
Documentation: https://lokalise.co/api2docs/curl/#transition-list-all-teams-get
Endpoints
Documentation: https://lokalise.co/api2docs/go/#resource-contributors
Endpoints
Documentation: https://lokalise.co/api2docs/go/#resource-translations
Endpoints
Is there any CI tooling available in your development setup that we can use e.g. CircleCI, Travis?
It would be great to have it running builds and unit tests (maybe even integration tests) on changes (and PRs)
Documentation: https://lokalise.co/api2docs/go/#resource-tasks
Endpoints
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.