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

Check command not working as intended #20

Open
pindab0ter opened this issue Nov 13, 2024 · 2 comments
Open

Check command not working as intended #20

pindab0ter opened this issue Nov 13, 2024 · 2 comments

Comments

@pindab0ter
Copy link
Contributor

Goal

Translate missing strings in en.json with nl.json as the reference.

Context

We have a large project using Laravel 11, Vue 2 and Vue I18n 8.x with ± 5000 lines per language file. Currently we have nl.json and en.json in /lang, where nl is the primary language.

Before attempting the translation I removed all lines from en.json ending in ": null,, readying the file to receive translations (see #16).

Method

  1. Configure the usage of OpenAI
    DEFAULT_TRANSLATOR_SERVICE=openai
    OPENAI_API_KEY=<api key>
    OPENAI_MODEL=gpt-4o-mini
    OPENAI_ORGANIZATION=<organization id>
  2. Run the following command
    php artisan translations:check en --source=nl --translate-missing --sort

Expected outcome

Missing translation strings are added with a translation provided by OpenAI.

Actual outcome

Checking translations...
No missing translations found.

No errors, but the missing keys or translations were also not there.

To verify, I then ran the same command without --translate-missing and it did add the missing translations with null as the value.

I then tried using free_google, which resulted in the keys of the source translation to end up as the value in en.json. It did go through the service, as one of the typos in the keys was fixed. This could however maybe be its own issue.

Please let me know if you need me to provide additional information.

Thoughts

My suspicion is that this might have to do with it being one large translation file containing roughly 5000 lines. This is the way Laravel recommends you to structure your translation files for large projects.

If the amount of data being too large is indeed the cause, maybe the translation process could be split up to prevent this from happening. But this is pure speculation from my end.

@Bottelet
Copy link
Owner

@pindab0ter do you have any way to reproduce this in a public repo? or able to send me something i can use for debugging?

@pindab0ter
Copy link
Contributor Author

I'll try with a smaller setup to see if u can reproduce it there. If not, I'm afraid the issue has to do with the size of the project, which is hard to replicate faithfully. The repo is not public.

It will be at least a week before I can get to doing this.

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