-
Notifications
You must be signed in to change notification settings - Fork 274
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
Crowdin API v2, allow editing of any files as XLIFF #633
Crowdin API v2, allow editing of any files as XLIFF #633
Conversation
- OAuth URL redirect via poedit.net replaced with direct to Crowdin OAuth URL but source tracking params added (to identify authentication via Poedit for statistics) - `state` param passed to OAuth URL and checked when callback URL with token received - Works already one new API `/user` so it shows that authenticated and full name of the user at the end of authentication process (when Authorize button pressed on authorization page)
JWT parsing without third-party deps
then in deps/wx
As it seems create some problem on MacOS plust looks more simple/elegant
i.e. which are not authorized to get file list etc.
from temporary arbitrary URL returned by API
In dropdown list of "Open from Crowdin" dialog
i.e. `{` from new line unless omitted due of single-line statement
- To keep Poedit workflows/behaviour consistent with how it worked with old Crowdin API v1 - As planned for deletion from API
5cdd02c
to
5d9204e
Compare
Without type casts in this commit. - Tried on GCC 7 and 8 with -std=gnu++14 and 17 - Even with latest as of now nlohmann/json@c05bd90 - While no errors on Visual Studio and Xcode without those casts
3f21d4e
to
f7e6799
Compare
to make more clear
In cpprest (casablanka) RESTful client
Now all files are supported
for setting remote (Crowdin side) file extension
- Fixed naming projName=>projIdentifier - Improved error messages to be more clear, excplanatory and precise
3792a79
to
6df545e
Compare
In `Catalog` Also improved detection of files opened from Crowdin via `Open from Crowdin` dialog (added "CrowdinSync_" at the beginning of each such filename)
And stuff related to it in `XLIFF1Catalog` and `XLIFF2Catalog`
There needs to be / between the prefix and the relative URLs; to keep the changes minimal, put it in the prefix.
gettext translations are normally uploaded as a POT file, not PO, while translations themselves are PO. Handle this case correctly.
Caught by Visual C++'s warning about comparing bool to int. Rephrased the condition to be more verbose, but more readable and less error-prone.
src/catalog.cpp
Outdated
@@ -602,8 +602,10 @@ void Catalog::SetFileName(const wxString& fn) | |||
|
|||
bool Catalog::IsFromCrowdin() const | |||
{ | |||
if((m_crowdinFileId > 0 && m_crowdinProjectId) > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that was definitely my "typo" during refactoring and I would never write above intentently :). And many apologies for this. That is why Visual Studio complained about it and it's pure luck it worked as expected (due Crowdin seems never assigns 0
to IDs) . It intended to be (m_crowdinFileId > 0 && m_crowdinProjectId > 0)
definitely. Anyway thanks a lot for catching this up and fixing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and I would never write above intentently :)
Of course. I'm simultaneously impressed that MSVC caught it and surprised than neither relatively modern GCC nor Clang did.
e0aa0b7
to
dced359
Compare
Thank you! I have now pushed most of the PR to the
I also improved formatting, fixed broken uses of gettext's |
I forgot to say: I also rebased on the new (macOS) networking implementation. There's one known problem: syncing PO files fails.
I thought my changes w.r.t PO vs POT handling caused it, but it's happening with PO too. |
This is fixed in 54b86a9. I am now seeing |
Hi Václav,
Fixed in this new PR #641 (using
`crowdin-v2` as base) as well as few other issues/bugs found during testing
on all platforms (see commits there for more details). One of issues
overlaps with that you already fixed as well on your own so far I see but
still improved variable scopes/captures to limit them to only where they
are really used. Please feel free to review/comment directly in PR or here
in email. Or to fix/correct/improve on your own.
And sorry for some delay due I was in the trip.
Best regards,
Serhiy
…On Wed, Jun 24, 2020 at 1:56 PM Václav Slavík ***@***.***> wrote:
I forgot to say: I also rebased on the new (macOS) networking
implementation.
There's one known problem: syncing PO files fails.
1. Click on *Collaborate on a Translation with Others*
2. Choose "Poedit Testing Sandbox" project (I invited you), language
e.g. Finnish, file default.po or any of the POT files, click OK.
3. Immediately click the *Sync* toolbar button.
4. Oops:
[image: Screen Shot 2020-06-24 at 12 55 56]
<https://user-images.githubusercontent.com/145881/85543111-0d7e3000-b61a-11ea-9ed0-f60e957ed83b.png>
I thought my changes w.r.t PO vs POT handling caused it, but it's
happening with PO too.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#633 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEWRVUUWIZJMJZOI6X3BNNDRYHLXLANCNFSM4NIZAKJQ>
.
|
I am now seeing X-Crowdin-Project-ID and X-Crowdin-File-ID headers in PO
files downloaded from Crowdin (both via API and manually). It seems that
big part of 9a58ee3
<9a58ee3>,
namely CrowdinUpdateCatalogIDsFromHeaders, can be safely removed after
all?
Yep, I am starting changes to that same PR
#641 to engage above to eliminate
that crappy CrowdinUpdateCatalogIDsFromHeaders so you'll see once I will
commit and also will let you know by email
Also now negotiating adding of `projId` attribute somewhere to top level
tag of XLIFF files as well so the same would work for XLIFF as well (i.e.
sync/upload of XLIFF files downloaded in browser as well) so if will be
added quickly as well from Crowdin side - it would make sense to include it
in your upcoming release as well.
…On Sat, Jun 27, 2020 at 5:51 PM Václav Slavík ***@***.***> wrote:
There's one known problem: syncing PO files fails.
This is fixed in 54b86a9
<54b86a9>
.
I am now seeing X-Crowdin-Project-ID and X-Crowdin-File-ID headers in PO
files downloaded from Crowdin (both via API and manually). It seems that
big part of 9a58ee3
<9a58ee3>,
namely CrowdinUpdateCatalogIDsFromHeaders, can be safely removed after
all?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#633 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEWRVUUMDANZJAB4X3VNKL3RYYBNRANCNFSM4NIZAKJQ>
.
|
- Done using of X-Crowdin-Project-ID and X-Crowdin-File-ID in
43870fc
- Crowdin server/API team answered that probable will implement
providing project ID for XLIFF files soon as well so probable it would be
good to include same approach for XLIFF as well
…On Wed, Jul 1, 2020 at 8:48 PM Serhiy Berezin ***@***.***> wrote:
I am now seeing X-Crowdin-Project-ID and X-Crowdin-File-ID headers in PO
> files downloaded from Crowdin (both via API and manually). It seems that
> big part of 9a58ee3
> <9a58ee3>,
> namely CrowdinUpdateCatalogIDsFromHeaders, can be safely removed after
> all?
Yep, I am starting changes to that same PR
#641 to engage above to eliminate
that crappy CrowdinUpdateCatalogIDsFromHeaders so you'll see once I will
commit and also will let you know by email
Also now negotiating adding of `projId` attribute somewhere to top level
tag of XLIFF files as well so the same would work for XLIFF as well (i.e.
sync/upload of XLIFF files downloaded in browser as well) so if will be
added quickly as well from Crowdin side - it would make sense to include it
in your upcoming release as well.
On Sat, Jun 27, 2020 at 5:51 PM Václav Slavík ***@***.***>
wrote:
> There's one known problem: syncing PO files fails.
>
> This is fixed in 54b86a9
> <54b86a9>
> .
>
> I am now seeing X-Crowdin-Project-ID and X-Crowdin-File-ID headers in PO
> files downloaded from Crowdin (both via API and manually). It seems that
> big part of 9a58ee3
> <9a58ee3>,
> namely CrowdinUpdateCatalogIDsFromHeaders, can be safely removed after
> all?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#633 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEWRVUUMDANZJAB4X3VNKL3RYYBNRANCNFSM4NIZAKJQ>
> .
>
|
Added support (from customer's prospective):
Improved
<project name>/<lang code>/<branch><path to file in Crowdin project>
Open from Crowdin
can be saved/synced back to Crowdin on further open and edit as local file from file system (simplest fromFile
menu's Recent list/history)Migrated to new:
This PR is clean version of #629 with
state
param passed to OAuth URL and checked when callback received