-
Notifications
You must be signed in to change notification settings - Fork 663
feat(compiler): move translation service initialization to see the logs #1705
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
base: main
Are you sure you want to change the base?
feat(compiler): move translation service initialization to see the logs #1705
Conversation
| `Initializing Lingo.dev compiler. Is dev mode: ${isDev}. Is main runner: ${isMainRunner()}`, | ||
| ); | ||
|
|
||
| // TODO (AleksandrSl 12/12/2025): Add API keys validation too, so we can log it nicely. |
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.
That's what is solved in the PR
| if (!this.translationService) { | ||
| throw new Error("Translation service not initialized"); | ||
| } |
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.
Quite dumb check, we make sure TranslationService is never null in constructor, since it's not something heavy we should delay creating
| const delay = this.config?.delayMedian ?? 0; | ||
| const actualDelay = this.getRandomDelay(delay); | ||
|
|
||
| this.logger.debug( |
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.
These were mostly added by LLM for debugging, we can add them back with LLM if needed
91c0bef to
85ceb48
Compare
We don't really need to initialize it inside the server, since server is only a way to use the service in the dev mode. Logs of the server are written to a file due to it being started from process which doesn't have access to console. But we want to see TranslationService initialization logs in the console, and the clearest way is to start it early, rather than extracting validation into a separate function.
85ceb48 to
bed9c1f
Compare
Summary
We don't really need to initialize it inside the server, since server is only a way to use the service in the dev mode.
Logs of the server are written to a file due to it being started from process which doesn't have access to console. But we want to see TranslationService initialization logs in the console, and the clearest way is to start it early, rather than extracting validation into a separate function.
Changes
Checklist