Skip to content

Commit

Permalink
Internationalize all messages without substitutions.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jan 7, 2017
1 parent 4fda1e4 commit 984f74d
Show file tree
Hide file tree
Showing 21 changed files with 3,317 additions and 807 deletions.
1,241 changes: 1,085 additions & 156 deletions res/locales/en_US.po

Large diffs are not rendered by default.

1,088 changes: 932 additions & 156 deletions res/locales/ua_UA.po

Large diffs are not rendered by default.

1,053 changes: 897 additions & 156 deletions res/messages.pot

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,20 @@ if(HAVE_GETTEXT)
set(output_pot ${CMAKE_CURRENT_SOURCE_DIR}/../res/messages.pot)
set(templ_po ${CMAKE_CURRENT_BINARY_DIR}/messages.po)
set(output_po ${CMAKE_CURRENT_SOURCE_DIR}/../res/locales/en_US.po)
set(inputs)
foreach(input ${solvespace_core_SOURCES})
list(APPEND inputs ${CMAKE_CURRENT_SOURCE_DIR}/${input})
endforeach()
set(inputs ${solvespace_core_SOURCES})

add_custom_command(
OUTPUT ${output_pot}
COMMAND ${XGETTEXT}
--keyword --keyword=_ --keyword=N_
--keyword --keyword=_ --keyword=N_ --keyword=C_:2,1c --keyword=CN_:2,1c
--force-po --width=100 --sort-by-file
--package-name=SolveSpace --package-version=3.0
--package-name=SolveSpace
--package-version=${solvespace_VERSION_MAJOR}.${solvespace_VERSION_MINOR}
"--copyright-holder=the PACKAGE authors"
--msgid-bugs-address=whitequark@whitequark.org
--from-code=utf-8 --output=${output_pot} ${inputs}
DEPENDS ${inputs}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Extracting translations"
VERBATIM)
add_custom_command(
Expand All @@ -240,7 +239,7 @@ if(HAVE_GETTEXT)
DEPENDS ${output_pot}
COMMENT "Updating English translations"
VERBATIM)
add_custom_target(solvespace-translations ALL
add_custom_target(solvespace-translations
DEPENDS ${output_pot} ${output_po})
endif()

Expand Down
24 changes: 12 additions & 12 deletions src/clipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {

void GraphicsWindow::MenuClipboard(Command id) {
if(id != Command::DELETE && !SS.GW.LockedInWorkplane()) {
Error("Cut, paste, and copy work only in a workplane.\n\n"
"Activate one with Sketch -> In Workplane.");
Error(_("Cut, paste, and copy work only in a workplane.\n\n"
"Activate one with Sketch -> In Workplane."));
return;
}

Expand All @@ -256,7 +256,7 @@ void GraphicsWindow::MenuClipboard(Command id) {

case Command::PASTE_TRANSFORM: {
if(SS.clipboard.r.n == 0) {
Error("Clipboard is empty; nothing to paste.");
Error(_("Clipboard is empty; nothing to paste."));
break;
}

Expand Down Expand Up @@ -303,7 +303,7 @@ bool TextWindow::EditControlDoneForPaste(const char *s) {
if(v > 0) {
shown.paste.times = v;
} else {
Error("Number of copies to paste must be at least one.");
Error(_("Number of copies to paste must be at least one."));
}
break;
}
Expand All @@ -319,7 +319,7 @@ bool TextWindow::EditControlDoneForPaste(const char *s) {
if(fabs(v) > 1e-6) {
shown.paste.scale = v;
} else {
Error("Scale cannot be zero.");
Error(_("Scale cannot be zero."));
}
break;
}
Expand Down Expand Up @@ -357,7 +357,7 @@ void TextWindow::ScreenPasteTransformed(int link, uint32_t v) {
Entity *e = SK.GetEntity(SS.GW.gs.point[0]);
SS.TW.shown.paste.origin = e->PointGetNum();
} else {
Error("Select one point to define origin of rotation.");
Error(_("Select one point to define origin of rotation."));
}
SS.GW.ClearSelection();
break;
Expand All @@ -369,7 +369,7 @@ void TextWindow::ScreenPasteTransformed(int link, uint32_t v) {
SS.TW.shown.paste.trans =
(pb->PointGetNum()).Minus(pa->PointGetNum());
} else {
Error("Select two points to define translation vector.");
Error(_("Select two points to define translation vector."));
}
SS.GW.ClearSelection();
break;
Expand All @@ -379,16 +379,16 @@ void TextWindow::ScreenPasteTransformed(int link, uint32_t v) {
SS.TW.shown.paste.trans.Magnitude() < LENGTH_EPS &&
SS.TW.shown.paste.times != 1)
{
Message("Transformation is identity. So all copies will be "
"exactly on top of each other.");
Message(_("Transformation is identity. So all copies will be "
"exactly on top of each other."));
}
if(SS.TW.shown.paste.times*SS.clipboard.r.n > 100) {
Error("Too many items to paste; split this into smaller "
"pastes.");
Error(_("Too many items to paste; split this into smaller "
"pastes."));
break;
}
if(!SS.GW.LockedInWorkplane()) {
Error("No workplane active.");
Error(_("No workplane active."));
break;
}
Entity *wrkpl = SK.GetEntity(SS.GW.ActiveWorkplane());
Expand Down
18 changes: 9 additions & 9 deletions src/confscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
if(sscanf(s, "%lf, %lf, %lf", &x, &y, &z)==3) {
SS.lightDir[edit.i] = Vector::From(x, y, z);
} else {
Error("Bad format: specify coordinates as x, y, z");
Error(_("Bad format: specify coordinates as x, y, z"));
}
InvalidateGraphics();
break;
Expand All @@ -336,7 +336,7 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
rgb = rgb.ClampWithin(0, 1);
SS.modelColor[edit.i] = RGBf(rgb.x, rgb.y, rgb.z);
} else {
Error("Bad format: specify color as r, g, b");
Error(_("Bad format: specify color as r, g, b"));
}
break;
}
Expand All @@ -361,8 +361,8 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
case Edit::CAMERA_TANGENT: {
SS.cameraTangent = (min(2.0, max(0.0, atof(s))))/1000.0;
if(!SS.usePerspectiveProj) {
Message("The perspective factor will have no effect until you "
"enable View -> Use Perspective Projection.");
Message(_("The perspective factor will have no effect until you "
"enable View -> Use Perspective Projection."));
}
InvalidateGraphics();
break;
Expand All @@ -375,7 +375,7 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
case Edit::DIGITS_AFTER_DECIMAL: {
int v = atoi(s);
if(v < 0 || v > 8) {
Error("Specify between 0 and 8 digits after the decimal.");
Error(_("Specify between 0 and 8 digits after the decimal."));
} else {
SS.SetUnitDigitsAfterDecimal(v);
}
Expand All @@ -387,7 +387,7 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
if(e) {
double ev = e->Eval();
if(fabs(ev) < 0.001 || isnan(ev)) {
Error("Export scale must not be zero!");
Error(_("Export scale must not be zero!"));
} else {
SS.exportScale = (float)ev;
}
Expand All @@ -399,7 +399,7 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
if(e) {
double ev = SS.ExprToMm(e);
if(isnan(ev) || ev < 0) {
Error("Cutter radius offset must not be negative!");
Error(_("Cutter radius offset must not be negative!"));
} else {
SS.exportOffset = (float)ev;
}
Expand Down Expand Up @@ -453,10 +453,10 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
SS.autosaveInterval = interval;
SetAutosaveTimerFor(interval);
} else {
Error("Bad value: autosave interval should be positive");
Error(_("Bad value: autosave interval should be positive"));
}
} else {
Error("Bad format: specify interval in integral minutes");
Error(_("Bad format: specify interval in integral minutes"));
}
break;
}
Expand Down

0 comments on commit 984f74d

Please sign in to comment.