flag

[Development Log] Trial and Error of AI Translation System: Differences Between Local and Server, and Pitfalls of Curl Version

Hello. Today, I'd like to share an interesting technical problem I encountered during blog development and the process of solving it.



1. The Origin of the Problem



In the local development environment (Windows), the text written by voice (Dictation) was translated normally, but in the actual operating server (Linux), the translation did not work.

At first, it seemed like a simple log error (sh: curl.exe: command not found) and I thought it was a path problem, but there was a deeper cause.



2. Cause Analysis




- OS Difference: Windows uses the curl.exe command, and Linux uses the curl command. The code did not automatically detect this.
- Curl Version Compatibility: The curl version installed on the server was 7.61.1 (2018). The high-speed parallel processing option (--parallel) that I applied was the latest feature supported only in 7.66.0 or higher. As a result, the translation request itself was failing on the server.
- AI Safety Filter: It was also found that some colloquial or slang-containing sentences were rejected for translation because they were caught by the AI's safety filter.


3. Solution Process




- Automatic OS Detection: I used the PHP_OS constant to determine whether the execution environment is Windows or Linux, and modified the code to select the appropriate command.
- Introduction of Sequential Processing Method: To ensure server compatibility, I gave up the latest feature, 'parallel processing', and completely reorganized the logic into a stable 'Sequential Batch Processing' method. The speed may be a little slower, but it guarantees 100% operation in any environment.
- Safety Filter Release: To allow free expression in blog posts, the safety filter was set to BLOCK_NONE during translation to allow translation without censorship.


4. Conclusion



Although the latest technology is good, I realized once again that understanding the operating environment (Legacy) must come first. Now, multilingual translation is provided stably in any environment.

Comments

No comments yet. Be the first to share your thoughts!

© 2026 My Blog. All rights reserved.