mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
Lang update (#13622)
* Update fix model * updated * List missing files * Orca Slicer to OrcaSlicer * Revert "Orca Slicer to OrcaSlicer" This reverts commit 711d796e05c4eaaa7579280f83f6ecd555fe3560. * Only update date if a change was made * Gcodewriter messages * #13432 update * Update OrcaSlicer_it.po
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -179,11 +179,12 @@ src/slic3r/GUI/KBShortcutsDialog.cpp
|
||||
src/slic3r/GUI/ReleaseNote.cpp
|
||||
src/slic3r/GUI/ReleaseNote.hpp
|
||||
src/slic3r/GUI/UpgradePanel.cpp
|
||||
src/slic3r/Utils/FixModelByWin10.cpp
|
||||
src/slic3r/Utils/FixModelByCgal.cpp
|
||||
src/slic3r/Utils/PresetUpdater.cpp
|
||||
src/slic3r/Utils/Http.cpp
|
||||
src/slic3r/Utils/Process.cpp
|
||||
src/libslic3r/GCode.cpp
|
||||
src/libslic3r/GCodeWriter.cpp
|
||||
src/libslic3r/GCode/ToolOrdering.cpp
|
||||
src/libslic3r/ExtrusionEntity.cpp
|
||||
src/libslic3r/Flow.cpp
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
@echo off
|
||||
REM OrcaSlicer gettext
|
||||
REM Created by SoftFever on 27/5/23.
|
||||
setlocal EnableExtensions EnableDelayedExpansion
|
||||
|
||||
REM Check for --full argument
|
||||
set FULL_MODE=0
|
||||
@@ -8,28 +9,132 @@ for %%a in (%*) do (
|
||||
if "%%a"=="--full" set FULL_MODE=1
|
||||
)
|
||||
|
||||
set "list_file=./localization/i18n/list.txt"
|
||||
set "pot_file=./localization/i18n/OrcaSlicer.pot"
|
||||
set "filtered_list=%TEMP%\orca_gettext_filtered_%RANDOM%_%RANDOM%.txt"
|
||||
set "missing_list=%TEMP%\orca_gettext_missing_%RANDOM%_%RANDOM%.txt"
|
||||
set "generated_root=%TEMP%\orca_gettext_generated_%RANDOM%_%RANDOM%"
|
||||
set "generated_i18n=%generated_root%\i18n"
|
||||
set "generated_pot=%generated_i18n%\OrcaSlicer.pot"
|
||||
set "has_sources=0"
|
||||
set "script_exit_code=0"
|
||||
|
||||
if %FULL_MODE%==1 (
|
||||
.\tools\xgettext.exe --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost -f ./localization/i18n/list.txt -o ./localization/i18n/OrcaSlicer.pot
|
||||
python scripts/HintsToPot.py ./resources ./localization/i18n
|
||||
call :prepareGettextList "%list_file%" "%filtered_list%" "%missing_list%"
|
||||
if "!has_sources!"=="1" (
|
||||
if not exist "%generated_i18n%" mkdir "%generated_i18n%"
|
||||
.\tools\xgettext.exe --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost -f "%filtered_list%" -o "%generated_pot%"
|
||||
if errorlevel 1 (
|
||||
set "script_exit_code=1"
|
||||
) else (
|
||||
python scripts/HintsToPot.py ./resources "%generated_i18n%"
|
||||
if errorlevel 1 (
|
||||
set "script_exit_code=1"
|
||||
) else (
|
||||
call :replaceIfMeaningful "%pot_file%" "%generated_pot%"
|
||||
if errorlevel 1 set "script_exit_code=1"
|
||||
)
|
||||
)
|
||||
) else (
|
||||
echo No existing source files found in %list_file%; skipping template regeneration.
|
||||
)
|
||||
)
|
||||
|
||||
if not "!script_exit_code!"=="0" goto :cleanup
|
||||
|
||||
REM Print the current directory
|
||||
echo %cd%
|
||||
set pot_file="./localization/i18n/OrcaSlicer.pot"
|
||||
|
||||
REM Run the script for each .po file
|
||||
for /r "./localization/i18n/" %%f in (*.po) do (
|
||||
call :processFile "%%f"
|
||||
if errorlevel 1 set "script_exit_code=1"
|
||||
)
|
||||
goto :eof
|
||||
|
||||
:cleanup
|
||||
call :reportMissing "%missing_list%"
|
||||
|
||||
if exist "%filtered_list%" del "%filtered_list%"
|
||||
if exist "%missing_list%" del "%missing_list%"
|
||||
if exist "%generated_root%" rd /s /q "%generated_root%"
|
||||
|
||||
endlocal & exit /b %script_exit_code%
|
||||
|
||||
:prepareGettextList
|
||||
set "input_list=%~1"
|
||||
set "filtered=%~2"
|
||||
set "missing=%~3"
|
||||
set "has_sources=0"
|
||||
type nul > "%filtered%"
|
||||
type nul > "%missing%"
|
||||
for /f "usebackq delims=" %%l in ("%input_list%") do (
|
||||
set "entry=%%l"
|
||||
if "!entry!"=="" (
|
||||
>> "%filtered%" echo.
|
||||
) else if "!entry:~0,1!"=="#" (
|
||||
>> "%filtered%" echo(!entry!
|
||||
) else if exist "!entry!" (
|
||||
>> "%filtered%" echo(!entry!
|
||||
set "has_sources=1"
|
||||
) else (
|
||||
>> "%missing%" echo(!entry!
|
||||
)
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
:reportMissing
|
||||
set "missing=%~1"
|
||||
if exist "%missing%" (
|
||||
for %%s in ("%missing%") do set "missing_size=%%~zs"
|
||||
if not "!missing_size!"=="0" (
|
||||
echo.
|
||||
echo Skipped missing source files listed in %list_file%:
|
||||
for /f "usebackq delims=" %%m in ("%missing%") do echo - %%m
|
||||
)
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
:replaceIfMeaningful
|
||||
set "target=%~1"
|
||||
set "candidate=%~2"
|
||||
if exist "%target%" (
|
||||
call :filesEqualIgnoringPotDate "%target%" "%candidate%"
|
||||
if not errorlevel 1 (
|
||||
del "%candidate%"
|
||||
exit /b 0
|
||||
)
|
||||
)
|
||||
move /Y "%candidate%" "%target%" > nul
|
||||
if errorlevel 1 exit /b 1
|
||||
exit /b 0
|
||||
|
||||
:filesEqualIgnoringPotDate
|
||||
set "left=%~1"
|
||||
set "right=%~2"
|
||||
if not exist "%left%" exit /b 1
|
||||
if not exist "%right%" exit /b 1
|
||||
python -c "import re,sys,pathlib; pattern=re.compile(r'^\"POT-Creation-Date: .*(?:\\r?\\n)?', re.M); normalize=lambda p: pattern.sub('', pathlib.Path(p).read_text(encoding='utf-8-sig')); sys.exit(0 if normalize(sys.argv[1])==normalize(sys.argv[2]) else 1)" "%left%" "%right%"
|
||||
exit /b %errorlevel%
|
||||
|
||||
:processFile
|
||||
set "file=%~1"
|
||||
set "dir=%~dp1"
|
||||
set "name=%~n1"
|
||||
set "lang=%name:OrcaSlicer_=%"
|
||||
if %FULL_MODE%==1 (
|
||||
.\tools\msgmerge.exe -N -o "%file%" "%file%" "%pot_file%"
|
||||
if %FULL_MODE%==1 if exist "%pot_file%" (
|
||||
set "merged_file=%TEMP%\orca_gettext_merged_%RANDOM%_%RANDOM%.po"
|
||||
.\tools\msgmerge.exe -N -o "!merged_file!" "%file%" "%pot_file%"
|
||||
if errorlevel 1 (
|
||||
if exist "!merged_file!" del "!merged_file!"
|
||||
echo Error encountered with msgmerge command for language !lang!.
|
||||
exit /b 1
|
||||
)
|
||||
call :replaceIfMeaningful "%file%" "!merged_file!"
|
||||
if errorlevel 1 exit /b 1
|
||||
)
|
||||
if not exist "./resources/i18n/%lang%" mkdir "./resources/i18n/%lang%"
|
||||
.\tools\msgfmt.exe --check-format -o "./resources/i18n/%lang%/OrcaSlicer.mo" "%file%"
|
||||
goto :eof
|
||||
if not exist "./resources/i18n/!lang!" mkdir "./resources/i18n/!lang!"
|
||||
.\tools\msgfmt.exe --check-format -o "./resources/i18n/!lang!/OrcaSlicer.mo" "%file%"
|
||||
if errorlevel 1 (
|
||||
echo Error encountered with msgfmt command for language !lang!.
|
||||
exit /b 1
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
@@ -4,6 +4,51 @@
|
||||
# Created by SoftFever on 27/5/23.
|
||||
#
|
||||
|
||||
list_file="./localization/i18n/list.txt"
|
||||
pot_file="./localization/i18n/OrcaSlicer.pot"
|
||||
filtered_list=""
|
||||
missing_list=""
|
||||
generated_root_dir=""
|
||||
|
||||
report_missing_files()
|
||||
{
|
||||
if [ -n "$missing_list" ] && [ -s "$missing_list" ]; then
|
||||
echo
|
||||
echo "Skipped missing source files listed in ${list_file}:"
|
||||
while IFS= read -r missing || [ -n "$missing" ]; do
|
||||
echo " - $missing"
|
||||
done < "$missing_list"
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup_temp_files()
|
||||
{
|
||||
[ -n "$filtered_list" ] && rm -f "$filtered_list"
|
||||
[ -n "$missing_list" ] && rm -f "$missing_list"
|
||||
[ -n "$generated_root_dir" ] && rm -rf "$generated_root_dir"
|
||||
}
|
||||
|
||||
files_equal_ignoring_pot_date()
|
||||
{
|
||||
file_a=$1
|
||||
file_b=$2
|
||||
norm_a=$(mktemp)
|
||||
norm_b=$(mktemp)
|
||||
|
||||
sed '/^"POT-Creation-Date: /d' "$file_a" > "$norm_a"
|
||||
sed '/^"POT-Creation-Date: /d' "$file_b" > "$norm_b"
|
||||
|
||||
if cmp -s "$norm_a" "$norm_b"; then
|
||||
rm -f "$norm_a" "$norm_b"
|
||||
return 0
|
||||
fi
|
||||
|
||||
rm -f "$norm_a" "$norm_b"
|
||||
return 1
|
||||
}
|
||||
|
||||
trap 'report_missing_files; cleanup_temp_files' EXIT
|
||||
|
||||
# Check for --full argument
|
||||
FULL_MODE=false
|
||||
for arg in "$@"
|
||||
@@ -14,21 +59,66 @@ do
|
||||
done
|
||||
|
||||
if $FULL_MODE; then
|
||||
xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost -f ./localization/i18n/list.txt -o ./localization/i18n/OrcaSlicer.pot
|
||||
python3 scripts/HintsToPot.py ./resources ./localization/i18n
|
||||
filtered_list=$(mktemp)
|
||||
missing_list=$(mktemp)
|
||||
has_sources=false
|
||||
|
||||
while IFS= read -r entry || [ -n "$entry" ]; do
|
||||
case "$entry" in
|
||||
""|\#*)
|
||||
printf '%s\n' "$entry" >> "$filtered_list"
|
||||
;;
|
||||
*)
|
||||
if [ -f "$entry" ]; then
|
||||
printf '%s\n' "$entry" >> "$filtered_list"
|
||||
has_sources=true
|
||||
else
|
||||
printf '%s\n' "$entry" >> "$missing_list"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < "$list_file"
|
||||
|
||||
if $has_sources; then
|
||||
generated_root_dir=$(mktemp -d)
|
||||
generated_i18n_dir="${generated_root_dir}/i18n"
|
||||
generated_pot_file="${generated_i18n_dir}/OrcaSlicer.pot"
|
||||
|
||||
mkdir -p "$generated_i18n_dir"
|
||||
xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost -f "$filtered_list" -o "$generated_pot_file"
|
||||
python3 scripts/HintsToPot.py ./resources "$generated_i18n_dir"
|
||||
|
||||
if [ -f "$pot_file" ] && files_equal_ignoring_pot_date "$pot_file" "$generated_pot_file"; then
|
||||
echo "No changes detected in ${pot_file}; keeping existing file."
|
||||
else
|
||||
mv "$generated_pot_file" "$pot_file"
|
||||
fi
|
||||
else
|
||||
echo "No existing source files found in ${list_file}; skipping template regeneration."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo "$0: working dir = $PWD"
|
||||
pot_file="./localization/i18n/OrcaSlicer.pot"
|
||||
for dir in ./localization/i18n/*/
|
||||
do
|
||||
dir=${dir%*/} # remove the trailing "/"
|
||||
lang=${dir##*/} # extract the language identifier
|
||||
|
||||
if [ -f "$dir/OrcaSlicer_${lang}.po" ]; then
|
||||
if $FULL_MODE; then
|
||||
msgmerge -N -o "$dir/OrcaSlicer_${lang}.po" "$dir/OrcaSlicer_${lang}.po" "$pot_file"
|
||||
if $FULL_MODE && [ -f "$pot_file" ]; then
|
||||
merged_po=$(mktemp)
|
||||
if ! msgmerge -N -o "$merged_po" "$dir/OrcaSlicer_${lang}.po" "$pot_file"; then
|
||||
echo "Error encountered with msgmerge command for language ${lang}."
|
||||
rm -f "$merged_po"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if files_equal_ignoring_pot_date "$dir/OrcaSlicer_${lang}.po" "$merged_po"; then
|
||||
rm -f "$merged_po"
|
||||
else
|
||||
mv "$merged_po" "$dir/OrcaSlicer_${lang}.po"
|
||||
fi
|
||||
fi
|
||||
mkdir -p "resources/i18n/${lang}"
|
||||
if ! msgfmt --check-format -o "resources/i18n/${lang}/OrcaSlicer.mo" "$dir/OrcaSlicer_${lang}.po"; then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "GCodeWriter.hpp"
|
||||
#include "CustomGCode.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
@@ -308,7 +309,7 @@ std::string GCodeWriter::set_accel_and_jerk(unsigned int acceleration, double je
|
||||
{
|
||||
// Only Klipper supports setting acceleration and jerk at the same time. Throw an error if we try to do this on other flavours.
|
||||
if(FLAVOR_IS_NOT(gcfKlipper))
|
||||
throw std::runtime_error("set_accel_and_jerk() is only supported by Klipper");
|
||||
throw std::runtime_error(_u8L("set_accel_and_jerk() is only supported by Klipper"));
|
||||
|
||||
// Clamp the acceleration to the allowed maximum.
|
||||
if (m_max_acceleration > 0 && acceleration > m_max_acceleration)
|
||||
@@ -461,10 +462,10 @@ std::string GCodeWriter::set_input_shaping(char axis, float damp, float freq, st
|
||||
break;
|
||||
}
|
||||
case gcfMarlinLegacy: {
|
||||
throw std::runtime_error("Input shaping is not supported by Marlin < 2.1.2.\nCheck your firmware version and update your G-code flavor to ´Marlin 2´");
|
||||
throw std::runtime_error(_u8L("Input shaping is not supported by Marlin < 2.1.2.\nCheck your firmware version and update your G-code flavor to ´Marlin 2´"));
|
||||
}
|
||||
default:
|
||||
throw std::runtime_error("Input shaping is only supported by Klipper, RepRapFirmware and Marlin 2");
|
||||
throw std::runtime_error(_u8L("Input shaping is only supported by Klipper, RepRapFirmware and Marlin 2"));
|
||||
}
|
||||
if (!gcode.str().empty()) {
|
||||
if (GCodeWriter::full_gcode_comment) {
|
||||
|
||||
Reference in New Issue
Block a user