Code Monkey home page Code Monkey logo

go-lokalise-api's People

Contributors

andrewlab-lokalise avatar beinarovic avatar crevil avatar dosexe avatar nathanbak avatar nemanjaaks avatar nickustinov avatar readper avatar ronnylv avatar sumanrana10048483 avatar yarlson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-lokalise-api's Issues

Getting unicode instead of string literal

Describe the bug
When retrieving translations instead of the string literal & I am getting the unicode \u0026 back.
This is only for the & character:
image

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.

Basic request setup

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.

{
  "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.

go.mod should be updated to v4

Describe the bug
As the major version tag is bumped to v4, module path in go.mod should be updated to v4.

module github.com/lokalise/go-lokalise-api/v3

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

Update method does not correspond to what is stated in the API

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:

  • Go 1.18
  • Client library version: v3.2.1

Additional context

Is it possible to update go-lokalise library for current version of the Lokalise API?

Testing setup

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.