Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zikwall opened this issue May 19, 2022 · 3 comments
Closed

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

zikwall opened this issue May 19, 2022 · 3 comments
Assignees

Comments

@zikwall
Copy link

zikwall commented May 19, 2022

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?

@zikwall
Copy link
Author

zikwall commented May 19, 2022

Also the body of the response to request above does not match:

{
    "project_id": "3002780358964f9bab5a92.87762498",
    "translation": {
        "translation_id": 344412,
        "key_id": 553662,
        "language_iso": "en_US",
        "modified_at": "2018-12-31 12:00:00 (Etc\/UTC)",
        "modified_at_timestamp": 1546257600,
        "modified_by": 420,
        "modified_by_email": "user@mycompany.com",
        "translation": "Quick brown fox jumps over the lazy dog.",
        "is_unverified": false,
        "is_reviewed": true,
        "reviewed_by": 1357,
        "words": 8,
        "custom_translation_statuses": [],
        "task_id": null,
        "segment_number": 1
    }
}

the client expects following struct:

type Translation struct {
	TranslationID   int64  `json:"translation_id"`
	Translation     string `json:"translation"` // could be string or json in case it includes plural forms and is_plural is true.
	KeyID           int64  `json:"key_id"`
	LanguageISO     string `json:"language_iso"`
	ModifiedAt      string `json:"modified_at"`
	ModifiedAtTs    int64  `json:"modified_at_timestamp"`
	ModifiedBy      int64  `json:"modified_by"`
	ModifiedByEmail string `json:"modified_by_email"`
	IsFuzzy         bool   `json:"is_fuzzy"`
	IsReviewed      bool   `json:"is_reviewed"`
	ReviewedBy      int64  `json:"reviewed_by"`
	Words           int64  `json:"words"`
	TaskID          int64  `json:"task_id"`

	CustomTranslationStatuses []TranslationStatus `json:"custom_translation_statuses"`
}

there is no is_unverified field

@Dosexe Dosexe self-assigned this Feb 10, 2023
@Dosexe
Copy link
Collaborator

Dosexe commented Feb 10, 2023

@zikwall Hi, sorry for a long delay, the issue will be fixed on next release on the next week.

@Dosexe
Copy link
Collaborator

Dosexe commented Feb 13, 2023

Fixed in v4.0.0

@Dosexe Dosexe closed this as completed Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants