extract translations from source code automatically #111
Replies: 3 comments 1 reply
-
How would the cli tool identify text that needs to be translated? In step 1 the dev would have to at least tag the text that needs to be translated. I've worked on multiple projects where we had no immediate need for translation but did this so that translations could be implemented at a later date. Using an attribute and dedicated function in scripts this requires very little effort. Assuming that has been done, then the tool could extract all strings to a file for hand-off to a translator. pros: very little friction in terms of development |
Beta Was this translation helpful? Give feedback.
-
LLMs are likely a crucial element to extract strings. Using ChatGPT to ask "what is hardcoded and what not?" should get us close |
Beta Was this translation helpful? Give feedback.
-
I vote for a lint rule. There is no need for extracting, but for showing where there is something to do and letting them handle edge cases by themselves. |
Beta Was this translation helpful? Give feedback.
-
Following idea:
inlang extract
commandTheoretically, a whole app could be i18n in a minute or so. Currently, i18n an existing app involves manually checking every file for hardcoded strings and copy & paste them into translation files. I just had to go through that process with the inlang dashboard. It took 5 hours, even though I was using the vscode extension which eliminates the copy & paste step.
Workflow
Option 1: Part of CI/CD
Developers run the
inlang extract
CLI command as part of their CI/CD pipeline.Pros
Cons
Option 2: One time process
The value of automatic extraction is extremely high when i18n an existing, previously not internationalized app (correct me if I am wrong). Subsequent extractions can be performed with the VS Code extension, avoiding ambiguity issues.
I am thinking of a tool like the Dart migration tool that exists(ed) for null-safety migration. Running the
inlang extract
command starts a process thatSee the Dart migrate tool in action https://youtu.be/eBr5tlumwlg?t=271
Pros
Cons
Beta Was this translation helpful? Give feedback.
All reactions