Localization.

* --boost option is added to gettext_make_pot script to recognize Boost format strings.
* New script gettext_merge_po_with_pot is added to merging new lines from POT to current PO
* --check-format option is added to gettext_po_to_mo script to check language dependent format strings during generation MO from PO.
* POT is updated and all PO files are merged with it. So, community can just load needed PO file and continue in translation.
* ExtruderSequenceDialog: Added messed localization markers
This commit is contained in:
YuSanka 2021-12-03 16:18:21 +01:00
parent 36b014a8dd
commit f14a5f40b3
38 changed files with 210255 additions and 126760 deletions

View File

@ -478,13 +478,27 @@ find_package(cereal REQUIRED)
# l10n
set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/localization")
add_custom_target(gettext_make_pot
COMMAND xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --debug
COMMAND xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --debug --boost
-f "${L10N_DIR}/list.txt"
-o "${L10N_DIR}/PrusaSlicer.pot"
COMMAND hintsToPot ${SLIC3R_RESOURCES_DIR} ${L10N_DIR}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generate pot file from strings in the source tree"
)
add_custom_target(gettext_merge_po_with_pot
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Merge localization po with new generted pot file"
)
file(GLOB L10N_PO_FILES "${L10N_DIR}/*/PrusaSlicer*.po")
foreach(po_file ${L10N_PO_FILES})
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
SET(po_new_file "${po_dir}/PrusaSlicer_.po")
add_custom_command(
TARGET gettext_merge_po_with_pot PRE_BUILD
COMMAND msgmerge -N -o ${po_file} ${po_file} "${L10N_DIR}/PrusaSlicer.pot"
DEPENDS ${po_file}
)
endforeach()
add_custom_target(gettext_po_to_mo
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generate localization po files (binary) from mo files (texts)"
@ -495,7 +509,8 @@ foreach(po_file ${L10N_PO_FILES})
SET(mo_file "${po_dir}/PrusaSlicer.mo")
add_custom_command(
TARGET gettext_po_to_mo PRE_BUILD
COMMAND msgfmt ARGS -o ${mo_file} ${po_file}
COMMAND msgfmt ARGS --check-format -o ${mo_file} ${po_file}
#COMMAND msgfmt ARGS --check-compatibility -o ${mo_file} ${po_file}
DEPENDS ${po_file}
)
endforeach()

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

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

View File

@ -161,7 +161,7 @@ ExtruderSequenceDialog::ExtruderSequenceDialog(const DoubleSlider::ExtrudersSequ
intervals_box_sizer->Add(m_intervals_grid_sizer, 0, wxLEFT, em);
option_sizer->Add(intervals_box_sizer, 0, wxEXPAND);
m_random_sequence = new wxCheckBox(this, wxID_ANY, "Random sequence");
m_random_sequence = new wxCheckBox(this, wxID_ANY, _L("Random sequence"));
m_random_sequence->SetValue(m_sequence.random_sequence);
m_random_sequence->SetToolTip(_L("If enabled, random sequence of the selected extruders will be used."));
m_random_sequence->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& e) {
@ -169,7 +169,7 @@ ExtruderSequenceDialog::ExtruderSequenceDialog(const DoubleSlider::ExtrudersSequ
m_color_repetition->Enable(m_sequence.random_sequence);
});
m_color_repetition = new wxCheckBox(this, wxID_ANY, "Allow next color repetition");
m_color_repetition = new wxCheckBox(this, wxID_ANY, _L("Allow next color repetition"));
m_color_repetition->SetValue(m_sequence.color_repetition);
m_color_repetition->SetToolTip(_L("If enabled, a repetition of the next random color will be allowed."));
m_color_repetition->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& e) {m_sequence.color_repetition = e.IsChecked(); });