-
Notifications
You must be signed in to change notification settings - Fork 4
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
XLIFF Sync - New Build with Translations command #122
Conversation
Thank you. This indeed looks very useful! 😊 I will check the PR more thoroughly, but I do already have some small suggestions for changes before we merge this into the develop branch. EDIT 2024-07-25 17:15 (CEST): I have left my initial comments. Could you please have a look at resolving those first? |
I can't seem to find any comments. But I don't use GitHub that much so perhaps I missed them. I looked in Files changed where I can make comments to files (lines) but there wasn't any comment. Where did you put them? 😅 |
Apparently I needed to click on a Submit Review button before the comments would be visible. 😅 You should be able to see them now. |
Applied all comments. Take your time checking this, there is no hurry 😄 . I reacted with "👍" on every comment I "solved" if you agree with me you can "resolve" the comment for real (I would say I don't resolve myself cause maybe you wont agree with my "solving" so I just react) |
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.
Just took some more time to better review your PR contentwise.
I was wondering why the "Build with Translations" command is deleting existing translation files?
I would prefer it to reuse the existing translation files, so that you don't lose your existing translations. I don't see the need to remove them and I think it might work counterproductive.
Could you check and/or explain?
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.
Rename (remove the custom_
).
Also for the other new files.
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.
Now that I think of it, these files are probably not referenced anymore now that the 'custom README' was removed.
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.
This one can be removed.
package.json
Outdated
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"pattern": "^[a-z]{2}-[A-Z]{2}$" |
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.
There are also some language tags that don't follow this pattern.
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.
Is there a pattern that works for all? Or is it the best to just remove the pattern entirely?
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.
They are RFC 4646 or RFC 5646 language tags, but I think it might be better to just remove the pattern as I otherwise a RegEx that is a bit too complex. I think it's good enough if people can type in anything they want and think for themselves whether it is a valid tag. ;)
src/features/tools/files-helper.ts
Outdated
* | ||
* @param {WorkspaceFolder} workspaceFolder The folder to restrict the search to. | ||
* | ||
* @returns A boolean that specifies wether translation files exist in the current workspace. |
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.
wether -> whether
src/features/tools/files-helper.ts
Outdated
* | ||
* @returns A boolean that specifies wether translation files exist in the current workspace. | ||
*/ | ||
public static async checkXliffFilesExist(workspaceFolder?: WorkspaceFolder): Promise<boolean> { |
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.
Rename to xliffFilesExist
src/features/trans-sync.ts
Outdated
@@ -381,3 +444,13 @@ async function autoRunTranslationChecks(workspaceFolder?: WorkspaceFolder, targe | |||
|
|||
await runTranslationChecksForWorkspaceFolder(autoCheckMissingTranslations, autoCheckNeedWorkTranslations, targetUri, workspaceFolder); | |||
} | |||
|
|||
function getCurrentWorkspaceFolder(): WorkspaceFolder | undefined { |
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.
Use method from WorkspaceHelper for selection of workspace folder(s) instead
So basically we don't use the Sync Feature because only our programmers create the Translations. So we don't want to have the "needs-work" (or how it was called) tags, because we always use the translations we created in the files. So if for example I add a new Label with a translation or change the translation of a label, that new translation will only get reviewed in the associated Pull Request by the Reviewer and then go directly into the Customers System. If I were to use the Sync command after I changed the Translation, I would only get the "needs-work" Tag added in the xliff files but not the new Translation (right? 😅). But as the new Translation is directly also the "final form" it should get added to the xliff files as normal which is why we normally delete the xliff files and call "create new target files" again. I hope that was understandable 😅 if something was unclear please let me know 😄 |
Do you mean you use the Considering there are also companies that do not use the parseFromDeveloperNote functionality (our company included), I think it would be better to have this "Build with Translations" do a "build + sync" instead of a "build + delete + recreate" so that you do not lose the translations you had in the target translation .xlf files. Is that something you could change? |
That already exists, i.e., |
Thanks totally forgot that xD. |
I am not sure what you mean. The base translation file (.g.xlf) is what the AL compiler generates and contains the source text in English (United States) en-US. (Strictly seen, therefore there is also not really a need for a separate .en-US.xlf file) If you would like me to have a look maybe you can share a sample project/xliff files to reproduce the problem, together with the VS Code settings you are using. You could also file that as a GitHub issue in this repository. |
We always use en-US and (mostly) de-DE as our languages. So 3 files: (en-US so you could in theory sent it someone ... i guess) I will also make an Issue to this. |
Everything works now. I will modify the command to just build + sync now |
Thanks for the changes. I have made some last changes to the PR and pushed a commit. I have replaced the statements that invoked the synchronization with a call to an existing method for it and I made some updates to the CHANGELOG and README. I have tested the functionality some further and it seems to work great! 😊 |
Also tested it and seems to be working fine. So you can go ahead and merge 👍 |
These changes were being stated very useful for faster development by my Company
Build with Translations
This adds a new command
xliffSync.buildWithTranslations
that combines functionalities to:Therefore 2 new settings are created:
Default Languages
Xliff file generation now uses the languages defined in this Setting
When the setting is empty (default) the user is asked to specifiy the languages (as normally)
Build Command To Execute
When using the new Command
Build with Translations
the command specified in this Setting will be used for building the AppThere are multiple whitespace changes due to VSCode handling the formatting.
if there are any questions or anything else feel free to contact me :)