This commit is contained in:
xiaoyeliu
2025-11-24 09:54:36 +08:00
parent 4a77785b84
commit babb2e1f1e
3 changed files with 10 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ Full manual for GNUgettext can be seen here: [http://www.gnu.org/software/gettex
2. Open this file in PoEdit as "Edit a translation"
3. Apply your corrections to the translation
4. Push changed OrcaSlicer_xx.po into the original folder
5. copy OrcaSlicer_xx.mo into resources/i18n/xx and rename it to OrcaSlicer.mo, then push the changed file.
5. copy OrcaSlicer_xx.mo into resources/i18n/xx and rename it to Snapmaker_Orca.mo, then push the changed file.
### Scenario 2. How do I add a new language support
@@ -31,7 +31,7 @@ Notice. When the translation is complete you need to:
- Rename the file to OrcaSlicer_fr.po
- Click "Save file" button. OrcaSlicer_fr.mo will be created immediately
- Bambu_Studio_fr.po needs to be copied into the sub-folder fr of [https://github.com/softfever/OrcaSlicer/tree/master/localization/i18n](https://github.com/softfever/OrcaSlicer/tree/master/localization/i18n), and be pushed
- copy OrcaSlicer_xx.mo into resources/i18n/xx and rename it to OrcaSlicer.mo, then push the changed file.
- copy OrcaSlicer_xx.mo into resources/i18n/xx and rename it to Snapmaker_Orca.mo, then push the changed file.
( name of folder "fr" means "French" - the translation language).
### Scenario 3. How do I add a new text resource when implementing a feature to OrcaSlicer
@@ -90,7 +90,7 @@ When you have Catalog to translation open POT or PO file in PoEdit and start tra
- We recommend using _PoEdit_ application for translation (as described above). It will help you eliminate most punctuation errors and will show you strings with "random" translations (if the fuzzy parameter was used).
- To check how the translated text looks on the UI elements, test it :) If you use _PoEdit_, all you need to do is save the file. At this point, a MO file will be created. Rename it OrcaSlicer.mo, and you can run OrcaSlicer (see above).
- To check how the translated text looks on the UI elements, test it :) If you use _PoEdit_, all you need to do is save the file. At this point, a MO file will be created. Rename it Snapmaker_Orca.mo, and you can run OrcaSlicer (see above).
- If you see an encoding error (garbage characters instead of Unicode) somewhere in OrcaSlicer, report it. It is likely not a problem of your translation, but a bug in the software.

View File

@@ -1,5 +1,5 @@
@echo off
REM OrcaSlicer gettext
REM Snapmaker_Orca gettext
REM Created by SoftFever on 27/5/23.
REM Check for --full argument
@@ -26,10 +26,10 @@ goto :eof
set "file=%~1"
set "dir=%~dp1"
set "name=%~n1"
set "lang=%name:OrcaSlicer_=%"
set "lang=%name:Snapmaker_Orca_=%"
if %FULL_MODE%==1 (
.\tools\msgmerge.exe -N -o "%file%" "%file%" "%pot_file%"
)
if not exist "./resources/i18n/%lang%" mkdir "./resources/i18n/%lang%"
.\tools\msgfmt.exe --check-format -o "./resources/i18n/%lang%/OrcaSlicer.mo" "%file%"
.\tools\msgfmt.exe --check-format -o "./resources/i18n/%lang%/Snapmaker_Orca.mo" "%file%"
goto :eof

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# OrcaSlicer gettext
# Snapmaker_Orca gettext
# Created by SoftFever on 27/5/23.
#
@@ -26,12 +26,12 @@ do
dir=${dir%*/} # remove the trailing "/"
lang=${dir##*/} # extract the language identifier
if [ -f "$dir/OrcaSlicer_${lang}.po" ]; then
if [ -f "$dir/Snapmaker_Orca_${lang}.po" ]; then
if $FULL_MODE; then
msgmerge -N -o "$dir/OrcaSlicer_${lang}.po" "$dir/OrcaSlicer_${lang}.po" "$pot_file"
msgmerge -N -o "$dir/Snapmaker_Orca_${lang}.po" "$dir/Snapmaker_Orca_${lang}.po" "$pot_file"
fi
mkdir -p "resources/i18n/${lang}"
if ! msgfmt --check-format -o "resources/i18n/${lang}/OrcaSlicer.mo" "$dir/OrcaSlicer_${lang}.po"; then
if ! msgfmt --check-format -o "resources/i18n/${lang}/Snapmaker_Orca.mo" "$dir/Snapmaker_Orca_${lang}.po"; then
echo "Error encountered with msgfmt command for language ${lang}."
exit 1 # Exit the script with an error status
fi