Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/prompts/ai-translation-user.prompt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ messages:
Language code: {{lang_code}}
Translation file: {{translation_file}}

Please read the translation file "{{translation_file}}" and translate all the strings from English to {{language}}.
Please read the content of the file "{{translation_file}}" and translate all the strings from English to {{language}}.

The file contains strings in the format "line_number:English text" - please translate only the text after the colon while preserving the exact line number and colon format.

Respond with ONLY the translated content in the same format, one line per string.
18 changes: 11 additions & 7 deletions .github/workflows/ai-translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,24 @@ jobs:
with:
name: translation-files

- name: Validate translation file exists
- name: Read translation file content
id: read_translation
run: |
translation_file="${{ matrix.file }}"
echo "🔍 Validating translation file: $translation_file"
echo "� Reading translation file: $translation_file"
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The emoji character appears corrupted or incorrectly encoded. Should use a proper emoji like '📖' for reading files.

Suggested change
echo " Reading translation file: $translation_file"
echo "📖 Reading translation file: $translation_file"

Copilot uses AI. Check for mistakes.

if [ ! -f "$translation_file" ]; then
echo "❌ Error: Translation file '$translation_file' not found"
exit 1
fi

file_size=$(wc -c < "$translation_file")
echo "📊 Translation file size: $file_size bytes"
echo "✅ Translation file validation completed successfully"
# Read file content and escape for YAML
content=$(cat "$translation_file" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed 's/$/\\n/g' | tr -d '\n')
echo "translation_content<<EOF" >> $GITHUB_OUTPUT
echo "$content" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
Comment on lines +235 to +238
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This complex sed pipeline for escaping content is error-prone and hard to maintain. Consider using a more robust approach like jq -Rs . or Python's json.dumps() for proper escaping of file content for YAML output.

Suggested change
content=$(cat "$translation_file" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed 's/$/\\n/g' | tr -d '\n')
echo "translation_content<<EOF" >> $GITHUB_OUTPUT
echo "$content" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Use jq to robustly escape file content for YAML/JSON
content=$(jq -Rs . < "$translation_file")
echo "translation_content=$content" >> $GITHUB_OUTPUT

Copilot uses AI. Check for mistakes.

echo "✅ Translation file content read successfully"

- name: Run AI translation
id: ai_translate
Expand All @@ -244,8 +249,7 @@ jobs:
language: ${{ matrix.language }}
lang_code: ${{ matrix.lang_code }}
translation_file: ${{ matrix.file }}
file_input: |
translation_content: ${{ matrix.file }}
file_input: ${{ matrix.file }}
enable-github-mcp: false
model: openai/gpt-4.1
max-tokens: 8000
Expand Down
Loading