Remove internationalization stuff.

- Remove "_" macro.
- Remove src/intl/ directory.
This commit is contained in:
David Capello 2010-09-18 23:54:56 -03:00
parent e2b8a8be1d
commit 46e847ef80
54 changed files with 173 additions and 564 deletions

View File

@ -35,11 +35,6 @@
// Defined in src/log.cpp
void verbose_printf(const char* format, ...);
// Strings
const char* msgids_get(const char* id); // src/intl/msgids.[ch]
#define _(msgid) (msgids_get(msgid))
#include <math.h>
#undef PI
#define PI 3.14159265358979323846

View File

@ -161,8 +161,6 @@ add_library(aseprite-library
file/pcx_format.cpp
file/png_format.cpp
file/tga_format.cpp
intl/intl.cpp
intl/msgids.cpp
jinete/jaccel.cpp
jinete/jalert.cpp
jinete/jbox.cpp

View File

@ -44,7 +44,6 @@
#include "core/file_system.h"
#include "core/modules.h"
#include "file/file.h"
#include "intl/intl.h"
#include "log.h"
#include "modules/editors.h"
#include "modules/gfx.h"
@ -78,7 +77,6 @@ class App::Modules
{
public:
// ASE Modules
IntlModule m_intl_module;
FileSystemModule m_file_system_module;
ToolBox m_toolbox;
RasterModule m_raster;
@ -250,7 +248,7 @@ int App::run()
Sprite* sprite = sprite_load(Vaca::convert_to<std::string>(option->data()).c_str());
if (!sprite) {
if (!isGui())
console.printf(_("Error loading file \"%s\"\n"), option->data().c_str());
console.printf("Error loading file \"%s\"\n", option->data().c_str());
}
else {
// Mount and select the sprite
@ -276,9 +274,6 @@ int App::run()
// Run the GUI
if (isGui()) {
// Select language
intl_set_lang("en");
// Support to drop files from Windows explorer
install_drop_files();
@ -424,7 +419,7 @@ bool app_realloc_recent_list()
}
}
else {
menuitem = menuitem_new(_("Nothing"), NULL, NULL);
menuitem = menuitem_new("Nothing", NULL, NULL);
menuitem->setEnabled(false);
jwidget_add_child(submenu, menuitem);
}

View File

@ -196,7 +196,7 @@ std::string Color::toFormalString(int imgtype, bool long_format) const
switch (getType()) {
case Color::MaskType:
result << _("Mask");
result << "Mask";
break;
case Color::RgbType:

View File

@ -82,7 +82,7 @@ CheckArgs::CheckArgs()
}
}
else {
console.printf(_("%s: option \"res\" requires an argument\n"),
console.printf("%s: option \"res\" requires an argument\n",
m_exeName.c_str());
usage(false);
}
@ -142,9 +142,7 @@ void CheckArgs::usage(bool showHelp)
PACKAGE, VERSION, COPYRIGHT);
// Usage
console.printf
("%s\n %s [%s] [%s]...\n\n",
_("Usage:"), m_exeName.c_str(), _("OPTION"), _("FILE"));
console.printf("Usage\n %s [OPTION] [FILE]...\n\n", m_exeName.c_str());
// Available Options
console.printf
@ -163,7 +161,7 @@ void CheckArgs::usage(bool showHelp)
}
// How to show options
else {
console.printf(_("Try \"%s --help\" for more information.\n"),
console.printf("Try \"%s --help\" for more information.\n",
m_exeName.c_str());
}
}

View File

@ -48,11 +48,11 @@ AboutCommand::AboutCommand()
void AboutCommand::onExecute(Context* context)
{
FramePtr frame(new Frame(false, _("About " PACKAGE)));
FramePtr frame(new Frame(false, "About " PACKAGE));
Widget* box1 = jbox_new(JI_VERTICAL);
Widget* grid = jgrid_new(2, false);
Label* title = new Label(PACKAGE " | Allegro Sprite Editor v" VERSION);
Label* subtitle = new Label(_("A pixel art program"));
Label* subtitle = new Label("A pixel art program");
Widget* authors_separator1 = ji_separator_new("Authors:", JI_HORIZONTAL | JI_TOP);
Widget* authors_separator2 = ji_separator_new(NULL, JI_HORIZONTAL);
Label* author1 = new LinkLabel("http://www.davidcapello.com.ar/", "David Capello");
@ -66,7 +66,7 @@ void AboutCommand::onExecute(Context* context)
Widget* bottom_box3 = jbox_new(JI_HORIZONTAL);
Label* copyright = new Label(COPYRIGHT);
Label* website = new LinkLabel(WEBSITE);
Button* close_button = new Button(_("&Close"));
Button* close_button = new Button("&Close");
jgrid_add_child(grid, title, 2, 1, 0);
jgrid_add_child(grid, subtitle, 2, 1, 0);

View File

@ -75,7 +75,7 @@ void AdvancedModeCommand::onExecute(Context* context)
Widget* warning_label = find_widget(window, "warning_label");
Widget* donot_show = find_widget(window, "donot_show");
strcpy(warning, _("You can back pressing the \"%s\" key."));
strcpy(warning, "You can back pressing the \"%s\" key.");
jaccel_to_string(accel, key);
sprintf(buf, warning, key);

View File

@ -87,7 +87,7 @@ void CelPropertiesCommand::onExecute(Context* context)
/* if the layer isn't writable */
if (!layer->is_writable()) {
button_ok->setText(_("Locked"));
button_ok->setText("Locked");
button_ok->setEnabled(false);
}

View File

@ -124,10 +124,8 @@ try_again:;
// see if the sprite has changes
while (sprite->isModified()) {
// ask what want to do the user with the changes in the sprite
int ret = jalert("%s<<%s<<%s||%s||%s||%s",
_("Warning"), _("Saving changes in:"),
get_filename(sprite->getFilename()),
_("&Save"), _("Do&n't Save"), _("&Cancel"));
int ret = jalert("Warning<<Saving changes in:<<%s||&Save||Do&n't Save||&Cancel",
get_filename(sprite->getFilename()));
if (ret == 1) {
// "save": save the changes

View File

@ -28,7 +28,6 @@
#include "commands/command.h"
#include "console.h"
#include "gfxmode.h"
#include "intl/intl.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "resource_finder.h"

View File

@ -85,7 +85,7 @@ static Layer* duplicate_layer(Sprite* sprite)
layer_copy->set_background(false);
layer_copy->set_moveable(true);
layer_copy->set_name(layer_copy->get_name() + " " + _("Copy"));
layer_copy->set_name(layer_copy->get_name() + " Copy");
/* add the new layer in the sprite */
if (undo_is_enabled(sprite->getUndo()))

View File

@ -73,7 +73,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
src_name->setText(get_filename(sprite->getFilename()));
sprintf(buf, "%s %s", sprite->getFilename(), _("Copy"));
sprintf(buf, "%s Copy", sprite->getFilename());
dst_name->setText(buf);
if (get_config_bool("DuplicateSprite", "Flatten", false))

View File

@ -52,7 +52,7 @@ void ExitCommand::onExecute(Context* context)
while (sprite) {
// check if this sprite is modified
if (sprite->isModified()) {
if (jalert(_("Warning<<There are sprites with changes.<<Do you want quit anyway?||&Yes||&No")) != 1) {
if (jalert("Warning<<There are sprites with changes.<<Do you want quit anyway?||&Yes||&No") != 1) {
return;
}
break;

View File

@ -73,7 +73,7 @@ void GotoPreviousLayerCommand::onExecute(Context* context)
current_editor->flashCurrentLayer();
app_get_statusbar()
->setStatusText(1000, _("Layer `%s' selected"),
->setStatusText(1000, "Layer `%s' selected",
sprite->getCurrentLayer()->get_name().c_str());
}
@ -122,7 +122,7 @@ void GotoNextLayerCommand::onExecute(Context* context)
current_editor->flashCurrentLayer();
app_get_statusbar()
->setStatusText(1000, _("Layer `%s' selected"),
->setStatusText(1000, "Layer `%s' selected",
sprite->getCurrentLayer()->get_name().c_str());
}

View File

@ -94,9 +94,8 @@ protected:
settings->setSnapToGrid(settings->getSnapToGrid() ? false: true);
refresh_all_editors();
usprintf(buf, _("Snap to grid: %s"),
settings->getSnapToGrid() ? _("On"):
_("Off"));
usprintf(buf, "Snap to grid: %s",
(settings->getSnapToGrid() ? "On": "Off"));
app_get_statusbar()->setStatusText(250, buf);
}

View File

@ -65,40 +65,40 @@ void LayerPropertiesCommand::onExecute(Context* context)
Layer* layer = sprite->getCurrentLayer();
bool with_blend_modes = (layer->is_image() && sprite->getImgType() != IMAGE_INDEXED);
FramePtr window(new Frame(false, _("Layer Properties")));
FramePtr window(new Frame(false, "Layer Properties"));
Widget* box1 = jbox_new(JI_VERTICAL);
Widget* box2 = jbox_new(JI_HORIZONTAL);
Widget* box3 = jbox_new(JI_HORIZONTAL + JI_HOMOGENEOUS);
Widget* label_name = new Label(_("Name:"));
Widget* label_name = new Label("Name:");
Widget* entry_name = jentry_new(256, layer->get_name().c_str());
Button* button_ok = new Button(_("&OK"));
Button* button_cancel = new Button(_("&Cancel"));
Button* button_ok = new Button("&OK");
Button* button_cancel = new Button("&Cancel");
button_ok->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window.get(), button_ok));
button_cancel->Click.connect(Vaca::Bind<void>(&Frame::closeWindow, window.get(), button_cancel));
if (with_blend_modes) {
label_bm = new Label(_("Blend mode:"));
label_bm = new Label("Blend mode:");
view_bm = jview_new();
list_bm = jlistbox_new();
jwidget_add_child(list_bm, jlistitem_new(_("Normal")));
jwidget_add_child(list_bm, jlistitem_new(_("Dissolve")));
jwidget_add_child(list_bm, jlistitem_new(_("Multiply")));
jwidget_add_child(list_bm, jlistitem_new(_("Screen")));
jwidget_add_child(list_bm, jlistitem_new(_("Overlay")));
jwidget_add_child(list_bm, jlistitem_new(_("Hard Light")));
jwidget_add_child(list_bm, jlistitem_new(_("Dodge")));
jwidget_add_child(list_bm, jlistitem_new(_("Burn")));
jwidget_add_child(list_bm, jlistitem_new(_("Darken")));
jwidget_add_child(list_bm, jlistitem_new(_("Lighten")));
jwidget_add_child(list_bm, jlistitem_new(_("Addition")));
jwidget_add_child(list_bm, jlistitem_new(_("Subtract")));
jwidget_add_child(list_bm, jlistitem_new(_("Difference")));
jwidget_add_child(list_bm, jlistitem_new(_("Hue")));
jwidget_add_child(list_bm, jlistitem_new(_("Saturation")));
jwidget_add_child(list_bm, jlistitem_new(_("Color")));
jwidget_add_child(list_bm, jlistitem_new(_("Luminosity")));
jwidget_add_child(list_bm, jlistitem_new("Normal"));
jwidget_add_child(list_bm, jlistitem_new("Dissolve"));
jwidget_add_child(list_bm, jlistitem_new("Multiply"));
jwidget_add_child(list_bm, jlistitem_new("Screen"));
jwidget_add_child(list_bm, jlistitem_new("Overlay"));
jwidget_add_child(list_bm, jlistitem_new("Hard Light"));
jwidget_add_child(list_bm, jlistitem_new("Dodge"));
jwidget_add_child(list_bm, jlistitem_new("Burn"));
jwidget_add_child(list_bm, jlistitem_new("Darken"));
jwidget_add_child(list_bm, jlistitem_new("Lighten"));
jwidget_add_child(list_bm, jlistitem_new("Addition"));
jwidget_add_child(list_bm, jlistitem_new("Subtract"));
jwidget_add_child(list_bm, jlistitem_new("Difference"));
jwidget_add_child(list_bm, jlistitem_new("Hue"));
jwidget_add_child(list_bm, jlistitem_new("Saturation"));
jwidget_add_child(list_bm, jlistitem_new("Color"));
jwidget_add_child(list_bm, jlistitem_new("Luminosity"));
jlistbox_select_index(list_bm, static_cast<LayerImage*>(layer)->get_blend_mode());

View File

@ -71,7 +71,7 @@ void LoadMaskCommand::onExecute(Context* context)
jstring filename = m_filename;
if (context->is_ui_available()) {
filename = ase_file_selector(_("Load .msk File"), filename, "msk");
filename = ase_file_selector("Load .msk File", filename, "msk");
if (filename.empty())
return;

View File

@ -77,7 +77,7 @@ void NewFrameCommand::onExecute(Context* context)
}
update_screen_for_sprite(sprite);
app_get_statusbar()
->showTip(1000, _("New frame %d/%d"),
->showTip(1000, "New frame %d/%d",
sprite->getCurrentFrame()+1,
sprite->getTotalFrames());
}

View File

@ -113,7 +113,7 @@ void NewLayerCommand::onExecute(Context* context)
update_screen_for_sprite(sprite);
app_get_statusbar()->dirty();
app_get_statusbar()->showTip(1000, _("Layer `%s' created"), name.c_str());
app_get_statusbar()->showTip(1000, "Layer `%s' created", name.c_str());
}
static std::string get_unique_layer_name(Sprite* sprite)

View File

@ -74,7 +74,7 @@ static void openfile_bg(void *fop_data)
fop_operate(fop);
}
catch (const std::exception& e) {
fop_error(fop, _("Error loading file:\n%s"), e.what());
fop_error(fop, "Error loading file:\n%s", e.what());
}
if (fop_is_stop(fop) && fop->sprite) {
@ -206,7 +206,7 @@ void OpenFileCommand::onExecute(Context* context)
delete data;
}
else {
console.printf(_("Error creating thread to load the sprite"));
console.printf("Error creating thread to load the sprite");
fop_free(fop);
}
}

View File

@ -338,11 +338,11 @@ static bool window_close_hook(JWidget widget, void *data)
static void load_command(JWidget widget)
{
Palette *palette;
jstring filename = ase_file_selector(_("Load Palette"), "", "png,pcx,bmp,tga,lbm,col");
jstring filename = ase_file_selector("Load Palette", "", "png,pcx,bmp,tga,lbm,col");
if (!filename.empty()) {
palette = Palette::load(filename.c_str());
if (!palette) {
jalert(_("Error<<Loading palette file||&Close"));
jalert("Error<<Loading palette file||&Close");
}
else {
set_new_palette(palette);
@ -357,14 +357,11 @@ static void save_command(JWidget widget)
int ret;
again:
filename = ase_file_selector(_("Save Palette"), "", "png,pcx,bmp,tga,col");
filename = ase_file_selector("Save Palette", "", "png,pcx,bmp,tga,col");
if (!filename.empty()) {
if (exists(filename.c_str())) {
ret = jalert("%s<<%s<<%s||%s",
_("Warning"),
_("File exists, overwrite it?"),
get_filename(filename.c_str()),
_("&Yes||&No||&Cancel"));
ret = jalert("Warning<<File exists, overwrite it?<<%s||&Yes||&No||&Cancel",
get_filename(filename.c_str()));
if (ret == 2)
goto again;
@ -374,7 +371,7 @@ static void save_command(JWidget widget)
Palette* palette = get_current_palette();
if (!palette->save(filename.c_str())) {
jalert(_("Error<<Saving palette file||&Close"));
jalert("Error<<Saving palette file||&Close");
}
}
}
@ -709,12 +706,12 @@ static void quantize_command(JWidget widget)
const CurrentSpriteReader& sprite(UIContext::instance());
if (sprite == NULL) {
jalert(_("Error<<There is no sprite selected to quantize.||&OK"));
jalert("Error<<There is no sprite selected to quantize.||&OK");
return;
}
if (sprite->getImgType() != IMAGE_RGB) {
jalert(_("Error<<You can use this command only for RGB sprites||&OK"));
jalert("Error<<You can use this command only for RGB sprites||&OK");
return;
}

View File

@ -57,7 +57,7 @@ void RedoCommand::onExecute(Context* context)
CurrentSpriteWriter sprite(context);
app_get_statusbar()
->showTip(1000, _("Redid %s"),
->showTip(1000, "Redid %s",
undo_get_next_redo_label(sprite->getUndo()));
undo_do_redo(sprite->getUndo());

View File

@ -75,7 +75,7 @@ void RemoveLayerCommand::onExecute(Context* context)
app_get_statusbar()->dirty();
app_get_statusbar()
->showTip(1000, _("Layer `%s' removed"),
->showTip(1000, "Layer `%s' removed",
layer_name.c_str());
}

View File

@ -54,7 +54,7 @@ static void savefile_bg(void *fop_data)
fop_operate(fop);
}
catch (const std::exception& e) {
fop_error(fop, _("Error saving file:\n%s"), e.what());
fop_error(fop, "Error saving file:\n%s", e.what());
}
fop_done(fop);
}
@ -167,11 +167,8 @@ static void save_as_dialog(Sprite* sprite, const char* dlg_title, bool mark_as_s
/* does the file exist? */
if (exists(filename.c_str())) {
/* ask if the user wants overwrite the file? */
ret = jalert("%s<<%s<<%s||%s||%s||%s",
_("Warning"),
_("File exists, overwrite it?"),
get_filename(filename.c_str()),
_("&Yes"), _("&No"), _("&Cancel"));
ret = jalert("Warning<<File exists, overwrite it?<<%s||&Yes||&No||&Cancel",
get_filename(filename.c_str()));
}
else
break;
@ -243,7 +240,7 @@ void SaveFileCommand::onExecute(Context* context)
save-as dialog to the user to select for first time the file-name
for this sprite */
else {
save_as_dialog(sprite, _("Save Sprite"), true);
save_as_dialog(sprite, "Save Sprite", true);
}
}
@ -278,7 +275,7 @@ bool SaveFileAsCommand::onEnabled(Context* context)
void SaveFileAsCommand::onExecute(Context* context)
{
CurrentSpriteWriter sprite(context);
save_as_dialog(sprite, _("Save Sprite As"), true);
save_as_dialog(sprite, "Save Sprite As", true);
}
//////////////////////////////////////////////////////////////////////
@ -315,7 +312,7 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
jstring old_filename = sprite->getFilename();
// show "Save As" dialog
save_as_dialog(sprite, _("Save Sprite Copy As"), false);
save_as_dialog(sprite, "Save Sprite Copy As", false);
// restore the file name
sprite->setFilename(old_filename.c_str());

View File

@ -67,17 +67,15 @@ void SaveMaskCommand::onExecute(Context* context)
int ret;
for (;;) {
filename = ase_file_selector(_("Save .msk File"), filename, "msk");
filename = ase_file_selector("Save .msk File", filename, "msk");
if (filename.empty())
return;
/* does the file exist? */
if (exists(filename.c_str())) {
/* ask if the user wants overwrite the file? */
ret = jalert("%s<<%s<<%s||%s||%s||%s",
_("Warning"), _("File exists, overwrite it?"),
get_filename(filename.c_str()),
_("&Yes"), _("&No"), _("&Cancel"));
ret = jalert("Warning<<File exists, overwrite it?<<%s||&Yes||&No||&Cancel",
get_filename(filename.c_str()));
}
else
break;
@ -93,9 +91,7 @@ void SaveMaskCommand::onExecute(Context* context)
}
if (save_msk_file(sprite->getMask(), filename.c_str()) != 0)
jalert("%s<<%s<<%s||%s",
_("Error"), _("Error saving .msk file"),
filename.c_str(), _("&Close"));
jalert("Error<<Error saving .msk file<<%s||&Close", filename.c_str());
}
//////////////////////////////////////////////////////////////////////

View File

@ -57,7 +57,7 @@ void UndoCommand::onExecute(Context* context)
CurrentSpriteWriter sprite(context);
app_get_statusbar()
->showTip(1000, _("Undid %s"),
->showTip(1000, "Undid %s",
undo_get_next_undo_label(sprite->getUndo()));
undo_do_undo(sprite->getUndo());

View File

@ -48,11 +48,11 @@ Console::Console()
console_counter > 1)
return;
else {
Frame* window = new Frame(false, _("Errors Console"));
Frame* window = new Frame(false, "Errors Console");
Widget* grid = jgrid_new(1, false);
Widget* view = jview_new();
Widget* textbox = jtextbox_new(NULL, JI_WORDWRAP);
Button* button = new Button(_("&Cancel"));
Button* button = new Button("&Cancel");
if (!grid || !textbox || !button)
return;

View File

@ -261,7 +261,7 @@ static FONT *my_load_font(const char *filename)
// Error loading font
if (!f) {
Console console;
console.printf(_("Error loading font.\n"));
console.printf("Error loading font.\n");
}
return f;
@ -270,7 +270,7 @@ static FONT *my_load_font(const char *filename)
static void button_font_command(JWidget widget)
{
jstring filename =
ase_file_selector(_("Open Font (TTF or Allegro bitmap format)"),
ase_file_selector("Open Font (TTF or Allegro bitmap format)",
get_config_string ("DrawText", "Font", ""),
"pcx,bmp,tga,lbm,ttf");

View File

@ -72,23 +72,23 @@ void dialogs_mask_color(Sprite* sprite)
if (!image)
return;
FramePtr window(new Frame(false, _("Mask by Color")));
FramePtr window(new Frame(false, "Mask by Color"));
box1 = jbox_new(JI_VERTICAL);
box2 = jbox_new(JI_HORIZONTAL);
box3 = jbox_new(JI_HORIZONTAL);
box4 = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
label_color = new Label(_("Color:"));
label_color = new Label("Color:");
button_color = new ColorButton
(get_config_color("MaskColor", "Color",
app_get_colorbar()->getFgColor()),
sprite->getImgType());
button_1 = new Button("1");
button_2 = new Button("2");
label_fuzziness = new Label(_("Fuzziness:"));
label_fuzziness = new Label("Fuzziness:");
slider_fuzziness = jslider_new(0, 255, get_config_int("MaskColor", "Fuzziness", 0));
check_preview = new CheckBox(_("&Preview"));
button_ok = new Button(_("&OK"));
button_cancel = new Button(_("&Cancel"));
check_preview = new CheckBox("&Preview");
button_ok = new Button("&OK");
button_cancel = new Button("&Cancel");
if (get_config_bool("MaskColor", "Preview", true))
check_preview->setSelected(true);

View File

@ -46,9 +46,9 @@ void ji_show_repo_dlg(RepoDlg *repo_dlg)
Widget* view = jview_new();
repo_dlg->listbox = jlistbox_new();
repo_dlg->button_use = new Button(repo_dlg->use_text);
repo_dlg->button_add = new Button(_("&Add"));
repo_dlg->button_delete = new Button(_("&Delete"));
Button* button_close = new Button(_("&Close"));
repo_dlg->button_add = new Button("&Add");
repo_dlg->button_delete = new Button("&Delete");
Button* button_close = new Button("&Close");
jwidget_add_hook(repo_dlg->listbox, repo_listbox_type(),
repo_listbox_msg_proc, repo_dlg);

View File

@ -140,7 +140,7 @@ static bool load_ASE(FileOp *fop)
return false;
if (!ase_file_read_header(f, &header)) {
fop_error(fop, _("Error reading header\n"));
fop_error(fop, "Error reading header\n");
fclose(f);
return false;
}
@ -150,7 +150,7 @@ static bool load_ASE(FileOp *fop)
header.depth == 16 ? IMAGE_GRAYSCALE: IMAGE_INDEXED,
header.width, header.height, header.ncolors);
if (!sprite) {
fop_error(fop, _("Error creating sprite with file spec\n"));
fop_error(fop, "Error creating sprite with file spec\n");
fclose(f);
return false;
}
@ -209,7 +209,7 @@ static bool load_ASE(FileOp *fop)
delete pal;
}
else
fop_error(fop, _("Warning: was found a color chunk in non-8bpp file\n"));
fop_error(fop, "Warning: was found a color chunk in non-8bpp file\n");
break;
case ASE_FILE_CHUNK_LAYER: {
@ -239,7 +239,7 @@ static bool load_ASE(FileOp *fop)
if (mask)
sprite->addMask(mask);
else
fop_error(fop, _("Warning: error loading a mask chunk\n"));
fop_error(fop, "Warning: error loading a mask chunk\n");
break;
}
@ -249,7 +249,7 @@ static bool load_ASE(FileOp *fop)
break;
default:
fop_error(fop, _("Warning: Unsupported chunk type %d (skipping)\n"), chunk_type);
fop_error(fop, "Warning: Unsupported chunk type %d (skipping)\n", chunk_type);
break;
}
@ -272,7 +272,7 @@ static bool load_ASE(FileOp *fop)
fop->sprite = sprite;
if (ferror(f)) {
fop_error(fop, _("Error reading file.\n"));
fop_error(fop, "Error reading file.\n");
fclose(f);
return false;
}
@ -344,7 +344,7 @@ static bool save_ASE(FileOp *fop)
ase_file_write_header(f, &header);
if (ferror(f)) {
fop_error(fop, _("Error writing file.\n"));
fop_error(fop, "Error writing file.\n");
fclose(f);
return false;
}
@ -999,12 +999,12 @@ static Cel *ase_file_read_cel_chunk(FILE *f, Sprite *sprite, int frame, int imgt
layer = sprite->indexToLayer(layer_index);
if (!layer) {
fop_error(fop, _("Frame %d didn't found layer with index %d\n"),
fop_error(fop, "Frame %d didn't found layer with index %d\n",
frame, layer_index);
return NULL;
}
if (!layer->is_image()) {
fop_error(fop, _("Invalid ASE file (frame %d in layer %d which does not contain images\n"),
fop_error(fop, "Invalid ASE file (frame %d in layer %d which does not contain images\n",
frame, layer_index);
return NULL;
}

View File

@ -660,20 +660,20 @@ static bool load_BMP(FileOp *fop)
case BI_BITFIELDS:
if (read_bitfields_image(f, image, &infoheader, rmask, gmask, bmask) < 0) {
image_free(image);
fop_error(fop, _("Unsupported bitfields in the BMP file.\n"));
fop_error(fop, "Unsupported bitfields in the BMP file.\n");
fclose(f);
return false;
}
break;
default:
fop_error(fop, _("Unsupported BMP compression.\n"));
fop_error(fop, "Unsupported BMP compression.\n");
fclose(f);
return false;
}
if (ferror(f)) {
fop_error(fop, _("Error reading file.\n"));
fop_error(fop, "Error reading file.\n");
fclose(f);
return false;
}
@ -719,7 +719,7 @@ static bool save_BMP(FileOp *fop)
f = fopen(fop->filename, "wb");
if (!f) {
fop_error(fop, _("Error creating file.\n"));
fop_error(fop, "Error creating file.\n");
return false;
}
@ -787,7 +787,7 @@ static bool save_BMP(FileOp *fop)
}
if (ferror(f)) {
fop_error(fop, _("Error writing file.\n"));
fop_error(fop, "Error writing file.\n");
fclose(f);
return false;
}

View File

@ -165,7 +165,7 @@ FileOp *fop_to_load_sprite(const char *filename, int flags)
/* does file exist? */
if (!file_exists(filename, FA_ALL, NULL)) {
fop_error(fop, _("File not found: \"%s\"\n"), filename);
fop_error(fop, "File not found: \"%s\"\n", filename);
goto done;
}
@ -173,7 +173,7 @@ FileOp *fop_to_load_sprite(const char *filename, int flags)
fop->format = get_fileformat(extension);
if (!fop->format ||
!fop->format->load) {
fop_error(fop, _("ASE can't load \"%s\" files\n"), extension);
fop_error(fop, "ASE can't load \"%s\" files\n", extension);
goto done;
}
@ -216,11 +216,11 @@ FileOp *fop_to_load_sprite(const char *filename, int flags)
App::instance()->isGui()) {
/* really want load all files? */
if ((jlist_length(fop->seq.filename_list) > 1) &&
(jalert(_("Notice"
"<<Possible animation with:"
"<<%s"
"<<Load the sequence of bitmaps?"
"||&Agree||&Skip"),
(jalert("Notice"
"<<Possible animation with:"
"<<%s"
"<<Load the sequence of bitmaps?"
"||&Agree||&Skip",
get_filename(filename)) != 1)) {
/* if the user replies "Skip", we need just one file name (the
first one) */
@ -268,7 +268,7 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
fop->format = get_fileformat(extension);
if (!fop->format ||
!fop->format->save) {
fop_error(fop, _("ASE can't save \"%s\" files\n"), extension);
fop_error(fop, "ASE can't save \"%s\" files\n", extension);
return fop;
}
@ -281,29 +281,29 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
case IMAGE_RGB:
if (!(fop->format->flags & FILE_SUPPORT_RGB)) {
usprintf(buf+ustrlen(buf), "<<- %s", _("RGB format"));
usprintf(buf+ustrlen(buf), "<<- %s", "RGB format");
fatal = true;
}
if (!(fop->format->flags & FILE_SUPPORT_RGBA) &&
fop->sprite->needAlpha()) {
usprintf(buf+ustrlen(buf), "<<- %s", _("Alpha channel"));
usprintf(buf+ustrlen(buf), "<<- %s", "Alpha channel");
}
break;
case IMAGE_GRAYSCALE:
if (!(fop->format->flags & FILE_SUPPORT_GRAY)) {
usprintf(buf+ustrlen(buf), "<<- %s", _("Grayscale format"));
usprintf(buf+ustrlen(buf), "<<- Grayscale format");
fatal = true;
}
if (!(fop->format->flags & FILE_SUPPORT_GRAYA) &&
fop->sprite->needAlpha()) {
usprintf(buf+ustrlen(buf), "<<- %s", _("Alpha channel"));
usprintf(buf+ustrlen(buf), "<<- Alpha channel");
}
break;
case IMAGE_INDEXED:
if (!(fop->format->flags & FILE_SUPPORT_INDEXED)) {
usprintf(buf+ustrlen(buf), "<<- %s", _("Indexed format"));
usprintf(buf+ustrlen(buf), "<<- Indexed format");
fatal = true;
}
break;
@ -313,13 +313,13 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
if (!(fop->format->flags & (FILE_SUPPORT_FRAMES |
FILE_SUPPORT_SEQUENCES))) {
if (fop->sprite->getTotalFrames() > 1)
usprintf(buf+ustrlen(buf), "<<- %s", _("Frames"));
usprintf(buf+ustrlen(buf), "<<- Frames");
}
// layers support
if (fop->sprite->getFolder()->get_layers_count() > 1) {
if (!(fop->format->flags & FILE_SUPPORT_LAYERS)) {
usprintf(buf+ustrlen(buf), "<<- %s", _("Layers"));
usprintf(buf+ustrlen(buf), "<<- Layers");
}
}
@ -327,7 +327,7 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
if (jlist_length(fop->sprite->getPalettes()) > 1) {
if (!(fop->format->flags & (FILE_SUPPORT_PALETTES |
FILE_SUPPORT_SEQUENCES))) {
usprintf(buf+ustrlen(buf), "<<- %s", _("Palette changes between frames"));
usprintf(buf+ustrlen(buf), "<<- Palette changes between frames");
}
}
@ -349,13 +349,13 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
}
if ((count > 0) && !(fop->format->flags & FILE_SUPPORT_MASKS_REPOSITORY)) {
usprintf(buf+ustrlen(buf), "<<- %s", _("Mask Repository"));
usprintf(buf+ustrlen(buf), "<<- Mask Repository");
}
}
if (!jlist_empty(fop->sprite->getPathsRepository())) {
if (!(fop->format->flags & FILE_SUPPORT_PATHS_REPOSITORY)) {
usprintf(buf+ustrlen(buf), "<<- %s", _("Path Repository"));
usprintf(buf+ustrlen(buf), "<<- Path Repository");
}
}
@ -366,13 +366,13 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
int ret;
if (fatal)
ret = jalert(_("Error<<File format \"%s\" doesn't support:%s"
"||&Close"),
ret = jalert("Error<<File format \"%s\" doesn't support:%s"
"||&Close",
fop->format->name, buf);
else
ret = jalert(_("Warning<<File format \"%s\" doesn't support:%s"
"<<Do you want continue?"
"||&Yes||&No"),
ret = jalert("Warning<<File format \"%s\" doesn't support:%s"
"<<Do you want continue?"
"||&Yes||&No",
fop->format->name, buf);
/* operation can't be done (by fatal error) or the user cancel
@ -501,7 +501,7 @@ void fop_operate(FileOp *fop)
/* call the "load" procedure to read the first bitmap */
loadres = (*fop->format->load)(fop);
if (!loadres) {
fop_error(fop, _("Error loading frame %d from file \"%s\"\n"),
fop_error(fop, "Error loading frame %d from file \"%s\"\n",
frame+1, fop->filename);
}
@ -576,7 +576,7 @@ void fop_operate(FileOp *fop)
else {
/* call the "load" procedure */
if (!(*fop->format->load)(fop))
fop_error(fop, _("Error loading sprite from file \"%s\"\n"),
fop_error(fop, "Error loading sprite from file \"%s\"\n",
fop->filename);
}
@ -637,7 +637,7 @@ void fop_operate(FileOp *fop)
/* call the "save" procedure... did it fail? */
if (!(*fop->format->save)(fop)) {
fop_error(fop, _("Error saving frame %d in the file \"%s\"\n"),
fop_error(fop, "Error saving frame %d in the file \"%s\"\n",
fop->sprite->getCurrentFrame()+1, fop->filename);
break;
}
@ -653,14 +653,14 @@ void fop_operate(FileOp *fop)
fop->sprite->setCurrentFrame(old_frame);
}
else {
fop_error(fop, _("Not enough memory for the temporary bitmap.\n"));
fop_error(fop, "Not enough memory for the temporary bitmap.\n");
}
}
/* direct save to a file */
else {
/* call the "save" procedure */
if (!(*fop->format->save)(fop))
fop_error(fop, _("Error saving the sprite in the file \"%s\"\n"),
fop_error(fop, "Error saving the sprite in the file \"%s\"\n",
fop->filename);
}
}
@ -765,13 +765,13 @@ Image *fop_sequence_image(FileOp *fop, int imgtype, int w, int h)
// Create a bitmap
if (fop->seq.last_cel) {
fop_error(fop, _("Error: called two times \"fop_sequence_image()\".\n"));
fop_error(fop, "Error: called two times \"fop_sequence_image()\".\n");
return NULL;
}
Image* image = image_new(imgtype, w, h);
if (!image) {
fop_error(fop, _("Not enough memory to allocate a bitmap.\n"));
fop_error(fop, "Not enough memory to allocate a bitmap.\n");
return NULL;
}

View File

@ -80,7 +80,7 @@ static bool load_FLI(FileOp *fop)
fseek(f, 128, SEEK_SET);
if (fli_header.magic == NO_HEADER) {
fop_error(fop, _("The file doesn't have a FLIC header\n"));
fop_error(fop, "The file doesn't have a FLIC header\n");
fclose(f);
return false;
}
@ -94,7 +94,7 @@ static bool load_FLI(FileOp *fop)
old = image_new(IMAGE_INDEXED, w, h);
pal = new Palette(0, 256);
if (!bmp || !old || !pal) {
fop_error(fop, _("Not enough memory.\n"));
fop_error(fop, "Not enough memory.\n");
if (bmp) image_free(bmp);
if (old) image_free(old);
if (pal) delete pal;
@ -135,20 +135,20 @@ static bool load_FLI(FileOp *fop)
/* add the new frame */
image = image_new_copy(bmp);
if (!image) {
fop_error(fop, _("Not enough memory\n"));
fop_error(fop, "Not enough memory\n");
break;
}
index = stock_add_image(sprite->getStock(), image);
if (index < 0) {
image_free(image);
fop_error(fop, _("Not enough memory\n"));
fop_error(fop, "Not enough memory\n");
break;
}
cel = cel_new(frpos_out, index);
if (!cel) {
fop_error(fop, _("Not enough memory\n"));
fop_error(fop, "Not enough memory\n");
break;
}
layer->add_cel(cel);
@ -251,7 +251,7 @@ static bool save_FLI(FileOp *fop)
bmp = image_new(IMAGE_INDEXED, sprite->getWidth(), sprite->getHeight());
old = image_new(IMAGE_INDEXED, sprite->getWidth(), sprite->getHeight());
if ((!bmp) || (!old)) {
fop_error(fop, _("Not enough memory for temporary bitmaps.\n"));
fop_error(fop, "Not enough memory for temporary bitmaps.\n");
if (bmp) image_free(bmp);
if (old) image_free(old);
fclose(f);

View File

@ -90,7 +90,7 @@ static bool load_GIF(FileOp *fop)
gif = gif_load_animation(fop->filename,
reinterpret_cast<void(*)(void*,float)>(fop_progress), fop);
if (!gif) {
fop_error(fop, _("Error loading GIF file.\n"));
fop_error(fop, "Error loading GIF file.\n");
goto error;
}
@ -99,13 +99,13 @@ static bool load_GIF(FileOp *fop)
opal = new Palette(0, 256);
npal = new Palette(0, 256);
if (!current_image || !current_image_old || !opal || !npal) {
fop_error(fop, _("Error creating temporary image.\n"));
fop_error(fop, "Error creating temporary image.\n");
goto error;
}
sprite = new Sprite(IMAGE_INDEXED, gif->width, gif->height, 256);
if (!sprite) {
fop_error(fop, _("Error creating sprite.\n"));
fop_error(fop, "Error creating sprite.\n");
goto error;
}
@ -113,7 +113,7 @@ static bool load_GIF(FileOp *fop)
layer = new LayerImage(sprite);
if (!layer) {
fop_error(fop, _("Error creating main layer.\n"));
fop_error(fop, "Error creating main layer.\n");
goto error;
}
@ -168,7 +168,7 @@ static bool load_GIF(FileOp *fop)
if (!cel || !image) {
if (cel) cel_free(cel);
if (image) image_free(image);
fop_error(fop, _("Error creating cel %d.\n"), i);
fop_error(fop, "Error creating cel %d.\n", i);
break;
}
@ -296,7 +296,7 @@ static bool save_GIF(FileOp *fop)
if (!bmp || !old) {
if (bmp) image_free(bmp);
if (old) image_free(old);
fop_error(fop, _("Not enough memory for temporary bitmaps.\n"));
fop_error(fop, "Not enough memory for temporary bitmaps.\n");
return false;
}
@ -304,7 +304,7 @@ static bool save_GIF(FileOp *fop)
if (!gif) {
image_free(bmp);
image_free(old);
fop_error(fop, _("Error creating GIF structure.\n"));
fop_error(fop, "Error creating GIF structure.\n");
return false;
}

View File

@ -87,13 +87,13 @@ static bool load_ICO(FileOp *fop)
header.entries = fgetw(f); // Number of icons
if (header.type != 1) {
fop_error(fop, _("Invalid ICO file type.\n"));
fop_error(fop, "Invalid ICO file type.\n");
fclose(f);
return false;
}
if (header.entries < 1) {
fop_error(fop, _("This ICO files does not contain images.\n"));
fop_error(fop, "This ICO files does not contain images.\n");
fclose(f);
return false;
}

View File

@ -234,7 +234,7 @@ static bool save_JPEG(FileOp *fop)
/* Open the file for write in it. */
file = fopen(fop->filename, "wb");
if (!file) {
fop_error(fop, _("Error creating file.\n"));
fop_error(fop, "Error creating file.\n");
return false;
}
@ -271,7 +271,7 @@ static bool save_JPEG(FileOp *fop)
buffer_height = 1;
buffer = (JSAMPARRAY)jmalloc(sizeof(JSAMPROW) * buffer_height);
if (!buffer) {
fop_error(fop, _("Not enough memory for the buffer.\n"));
fop_error(fop, "Not enough memory for the buffer.\n");
jpeg_destroy_compress(&cinfo);
fclose(file);
return false;
@ -281,7 +281,7 @@ static bool save_JPEG(FileOp *fop)
buffer[c] = (JSAMPROW)jmalloc(sizeof(JSAMPLE) *
cinfo.image_width * cinfo.num_components);
if (!buffer[c]) {
fop_error(fop, _("Not enough memory for buffer scanlines.\n"));
fop_error(fop, "Not enough memory for buffer scanlines.\n");
for (c--; c>=0; c--)
jfree(buffer[c]);
jfree(buffer);

View File

@ -61,7 +61,7 @@ static bool load_PCX(FileOp *fop)
fgetc(f); /* skip encoding flag */
if (fgetc(f) != 8) { /* we like 8 bit color planes */
fop_error(fop, _("This PCX doesn't have 8 bit color planes.\n"));
fop_error(fop, "This PCX doesn't have 8 bit color planes.\n");
fclose(f);
return false;
}
@ -166,7 +166,7 @@ static bool load_PCX(FileOp *fop)
}
if (ferror(f)) {
fop_error(fop, _("Error reading file.\n"));
fop_error(fop, "Error reading file.\n");
fclose(f);
return false;
}
@ -189,7 +189,7 @@ static bool save_PCX(FileOp *fop)
f = fopen(fop->filename, "wb");
if (!f) {
fop_error(fop, _("Error creating file.\n"));
fop_error(fop, "Error creating file.\n");
return false;
}
@ -292,7 +292,7 @@ static bool save_PCX(FileOp *fop)
}
if (ferror(f)) {
fop_error(fop, _("Error writing file.\n"));
fop_error(fop, "Error writing file.\n");
fclose(f);
return false;
}

View File

@ -382,7 +382,7 @@ static bool load_TGA(FileOp *fop)
}
if (ferror(f)) {
fop_error(fop, _("Error reading file.\n"));
fop_error(fop, "Error reading file.\n");
fclose(f);
return false;
}
@ -407,7 +407,7 @@ static bool save_TGA(FileOp *fop)
f = fopen(fop->filename, "wb");
if (!f) {
fop_error(fop, _("Error creating file.\n"));
fop_error(fop, "Error creating file.\n");
return false;
}
@ -475,7 +475,7 @@ static bool save_TGA(FileOp *fop)
}
if (ferror(f)) {
fop_error(fop, _("Error writing file.\n"));
fop_error(fop, "Error writing file.\n");
fclose(f);
return false;
}

View File

@ -109,13 +109,13 @@ bool CurrentGfxModeGuard::tryGfxMode(const GfxMode& newMode)
if (!m_oldMode.setGfxMode()) {
// Oh no! more errors!, we can't restore the old graphics mode!
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message(_("FATAL ERROR: Unable to restore the old graphics mode!\n"));
allegro_message("FATAL ERROR: Unable to restore the old graphics mode!\n");
exit(1);
}
// Only print a message of the old error
else {
Console console;
console.printf(_("Error setting graphics mode: %dx%d %d bpp\n"),
console.printf("Error setting graphics mode: %dx%d %d bpp\n",
newMode.getWidth(), newMode.getHeight(), newMode.getDepth());
return false;
}

View File

@ -1,164 +0,0 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2010 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <allegro/file.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "core/cfg.h"
#include "intl/intl.h"
#include "intl/msgids.h"
#include "modules/gui.h"
#include "resource_finder.h"
IntlModule::IntlModule()
{
PRINTF("Internationalization module: starting\n");
// load the language file
intl_load_lang();
PRINTF("Internationalization module: started\n");
}
IntlModule::~IntlModule()
{
PRINTF("Internationalization module: shutting down\n");
msgids_clear();
PRINTF("Internationalization module: shut down\n");
}
void intl_load_lang()
{
const char *lang = intl_get_lang();
char buf[512];
sprintf(buf, "po/%s.po", lang);
ResourceFinder rf;
rf.findInDataDir(buf);
while (const char* path = rf.next()) {
if (exists(path)) {
if (msgids_load(path) < 0) {
// TODO error loading language file... doesn't matter
}
break;
}
}
}
const char *intl_get_lang()
{
return get_config_string("Options", "Language", "en");
}
void intl_set_lang(const char *lang)
{
set_config_string("Options", "Language", lang);
/* clear msgids and load them again */
msgids_clear();
intl_load_lang();
}
/* int init_intl() */
/* { */
/* #ifdef ENABLE_NLS */
/* char buf[512], locale_path[512]; */
/* DIRS *dirs, *dir; */
/* strcpy(buf, "locale"); */
/* dirs = filename_in_datadir(buf); */
/* /\* search the configuration file from first to last path *\/ */
/* for (dir=dirs; dir; dir=dir->next) { */
/* if ((dir->path) && file_exists (dir->path, FA_DIREC, NULL)) { */
/* strcpy(buf, dir->path); */
/* break; */
/* } */
/* } */
/* dirs_free(dirs); */
/* fix_filename_path(locale_path, buf, sizeof(locale_path)); */
/* #ifndef __MINGW32__ */
/* setlocale(LC_MESSAGES, ""); */
/* bindtextdomain(PACKAGE, locale_path); */
/* textdomain(PACKAGE); */
/* setenv("OUTPUT_CHARSET", "ISO-8859-1", true); */
/* #endif */
/* /\* Set current language. *\/ */
/* /\* const char *langname = get_config_string("Options", "Language", ""); *\/ */
/* /\* setenv("LANGUAGE", "en", 1); *\/ */
/* /\* { *\/ */
/* /\* extern int _nl_msg_cat_cntr; *\/ */
/* /\* ++_nl_msg_cat_cntr; *\/ */
/* /\* } *\/ */
/* #endif */
/* return 0; */
/* } */
/* const char *get_language_code() */
/* { */
/* #ifdef ENABLE_NLS */
/* static char buf[8]; */
/* const char *language; */
/* language = getenv("LANGUAGE"); */
/* if (language != NULL && language[0] == '\0') */
/* language = NULL; */
/* if (!language) { */
/* language = getenv("LC_ALL"); */
/* if (language != NULL && language[0] == '\0') */
/* language = NULL; */
/* } */
/* if (!language) { */
/* language = getenv("LANG"); */
/* if (language != NULL && language[0] == '\0') */
/* language = NULL; */
/* } */
/* if (language && language[0] && language[1]) */
/* sprintf(buf, "%c%c", language[0], language[1]); */
/* else */
/* strcpy(buf, "en"); */
/* return buf; */
/* #else */
/* return "en"; */
/* #endif */
/* } */
/* #ifdef ENABLE_NLS */
/* #ifdef __MINGW32__ */
/* char *gettext(const char *__msgid) */
/* { */
/* return gettext__ (__msgid); */
/* } */
/* #endif */
/* #endif */

View File

@ -1,33 +0,0 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2010 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef INTL_INTL_H_INCLUDED
#define INTL_INTL_H_INCLUDED
class IntlModule
{
public:
IntlModule();
~IntlModule();
};
void intl_load_lang();
const char *intl_get_lang();
void intl_set_lang(const char *lang);
#endif

View File

@ -1,101 +0,0 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2010 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include "jinete/jbase.h"
#include "util/filetoks.h"
#include "util/hash.h"
static HashTable* msgids = NULL;
static void free_msgid(void *msgid);
int msgids_load(const char *filename)
{
char buf[4096], leavings[4096];
char id[4096], trans[4096];
int donotread = false;
FILE *f;
f = fopen(filename, "r");
if (!f)
return -1;
if (!msgids)
msgids = hash_new(64);
tok_reset_line_num();
strcpy(leavings, "");
while (donotread || tok_read (f, buf, leavings, sizeof (leavings))) {
donotread = false;
/* new msgid */
if (strncmp ("msgid", buf, 5) == 0) {
strcpy(id, "");
strcpy(trans, "");
while (tok_read(f, buf, leavings, sizeof(leavings)) &&
strncmp("msgstr", buf, 6) != 0)
strcat(id, buf);
if (strncmp("msgstr", buf, 6) == 0) {
while (tok_read(f, buf, leavings, sizeof(leavings)) &&
strncmp("msgid", buf, 5) != 0)
strcat(trans, buf);
if (strncmp("msgid", buf, 5) == 0)
donotread = true;
if (strlen(id) > 0 && strlen(trans) > 0)
hash_insert(msgids, id, jstrdup(trans));
}
}
}
fclose(f);
return 0;
}
void msgids_clear()
{
if (msgids) {
hash_free(msgids, free_msgid);
msgids = NULL;
}
}
const char *msgids_get(const char *id)
{
if (msgids) {
const char* trans = reinterpret_cast<const char*>(hash_lookup(msgids, id));
if (trans)
return trans;
}
return id;
}
static void free_msgid(void *msgid)
{
jfree(msgid);
}

View File

@ -1,26 +0,0 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2010 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef INTL_MSGIDS_H_INCLUDED
#define INTL_MSGIDS_H_INCLUDED
int msgids_load(const char* filename);
void msgids_clear();
const char* msgids_get(const char* id);
#endif

View File

@ -55,10 +55,6 @@ int ji_screen_h = 0;
volatile int ji_clock = 0;
/* Hook to translate strings. */
static const char *(*strings_hook)(const char *msgid) = NULL;
/* Current mouse cursor type. */
static int m_cursor;
@ -227,19 +223,6 @@ void ji_flip_rect(JRect rect)
}
}
void ji_set_translation_hook(const char *(*gettext)(const char *msgid))
{
strings_hook = gettext;
}
const char *ji_translate_string(const char *msgid)
{
if (strings_hook)
return (*strings_hook)(msgid);
else
return msgid;
}
int jmouse_get_cursor()
{
return m_cursor;

View File

@ -54,12 +54,6 @@ void ji_add_dirty_region(JRegion region);
void ji_flip_dirty_region();
void ji_flip_rect(JRect rect);
/***********************************************************************/
/* strings related */
void ji_set_translation_hook(const char *(*gettext) (const char *msgid));
const char *ji_translate_string(const char *msgid);
/***********************************************************************/
/* timer related */

View File

@ -50,5 +50,5 @@ void Launcher::openFile(const std::string& file)
#endif
if (ret != 0)
jalert(_("Problem<<Cannot open:<<%s||&Close"), file.c_str());
jalert("Problem<<Cannot open:<<%s||&Close", file.c_str());
}

View File

@ -255,7 +255,7 @@ void set_sprite_in_more_reliable_editor(Sprite* sprite)
void split_editor(Editor* editor, int align)
{
if (count_parents(editor) > 10) {
jalert(_("Error<<You cannot split this editor more||&Close"));
jalert("Error<<You cannot split this editor more||&Close");
return;
}

View File

@ -40,7 +40,6 @@
#include "core/cfg.h"
#include "core/drop_files.h"
#include "gfxmode.h"
#include "intl/msgids.h"
#include "modules/editors.h"
#include "modules/gfx.h"
#include "modules/gui.h"
@ -290,10 +289,7 @@ gfx_done:;
/* setup the standard jinete theme for widgets */
ji_set_theme(ase_theme = new SkinneableTheme());
/* set hook to translate strings */
ji_set_translation_hook(msgids_get);
#ifdef HAVE_RESIZE_PATCH
set_resize_callback(resize_callback);
@ -523,7 +519,7 @@ void gui_flip_screen()
if (!lastWorkingGfxMode.setGfxMode()) {
PRINTF("Fatal error\n");
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message(_("FATAL ERROR: Unable to restore the old graphics mode!\n"));
allegro_message("FATAL ERROR: Unable to restore the old graphics mode!\n");
exit(1);
}

View File

@ -30,7 +30,6 @@
#include "commands/commands.h"
#include "commands/params.h"
#include "console.h"
#include "intl/intl.h"
#include "modules/gui.h"
#include "modules/rootmenu.h"
#include "resource_finder.h"

View File

@ -176,7 +176,7 @@ void clipboard::copy(const SpriteReader& sprite)
if (!copy_from_sprite(sprite)) {
Console console;
console.printf(_("Can't copying an image portion from the current layer\n"));
console.printf("Can't copying an image portion from the current layer\n");
}
}

View File

@ -103,7 +103,7 @@ Frame* colorselector_new()
colorselector->selected_model = &models[0];
/* palette */
jwidget_add_tooltip_text(pal, _("Use SHIFT or CTRL to select ranges"));
jwidget_add_tooltip_text(pal, "Use SHIFT or CTRL to select ranges");
/* data for a better layout */
grid1->child_spacing = 0;
@ -115,7 +115,7 @@ Frame* colorselector_new()
// Append one button for each color-model
for (m=models; m->text!=NULL; ++m) {
// Create the color-model button to select it
RadioButton* model_button = new RadioButton(_(m->text), 1, JI_BUTTON);
RadioButton* model_button = new RadioButton(m->text, 1, JI_BUTTON);
colorselector->model_buttons.push_back(model_button);
setup_mini_look(model_button);
model_button->Click.connect(Vaca::Bind<bool>(&select_model_hook, window, m));

View File

@ -1050,14 +1050,12 @@ bool Editor::onProcessMessage(JMessage msg)
(m_sprite->getCurrentLayer()->getType() == GFXOBJ_LAYER_IMAGE)) {
// TODO you can move the `Background' with tiled mode
if (m_sprite->getCurrentLayer()->is_background()) {
jalert(_(PACKAGE
"<<You can't move the `Background' layer."
"||&Close"));
jalert(PACKAGE
"<<You can't move the `Background' layer."
"||&Close");
}
else if (!m_sprite->getCurrentLayer()->is_moveable()) {
jalert(_(PACKAGE
"<<The layer movement is locked."
"||&Close"));
jalert(PACKAGE "<<The layer movement is locked.||&Close");
}
else {
bool click2 = get_config_bool("Options", "MoveClick2", FALSE);
@ -1075,9 +1073,7 @@ bool Editor::onProcessMessage(JMessage msg)
Image* image = m_sprite->getCurrentImage(&x, &y, &opacity);
if (image) {
if (!m_sprite->getCurrentLayer()->is_writable()) {
jalert(_(PACKAGE
"<<The layer is locked."
"||&Close"));
jalert(PACKAGE "<<The layer is locked.||&Close");
return true;
}
@ -2093,26 +2089,24 @@ IToolLoop* Editor::createToolLoopImpl(Context* context, JMessage msg)
Layer* layer = sprite->getCurrentLayer();
if (!layer) {
jalert(_(PACKAGE
"<<The current sprite does not have any layer."
"||&Close"));
jalert(PACKAGE "<<The current sprite does not have any layer.||&Close");
return NULL;
}
// if the active layer is not visible
if (!layer->is_readable()) {
jalert(_(PACKAGE
"<<The current layer is hidden,"
"<<make it visible and try again"
"||&Close"));
jalert(PACKAGE
"<<The current layer is hidden,"
"<<make it visible and try again"
"||&Close");
return NULL;
}
// if the active layer is read-only
else if (!layer->is_writable()) {
jalert(_(PACKAGE
"<<The current layer is locked,"
"<<unlock it and try again"
"||&Close"));
jalert(PACKAGE
"<<The current layer is locked,"
"<<unlock it and try again"
"||&Close");
return NULL;
}

View File

@ -37,11 +37,6 @@
((c) == '\n') || \
((c) == '\r'))
/* TODO */
/* #define TRANSLATE_ATTR(a) \ */
/* (((a) != NULL && (a)[0] == '_') ? \ */
/* ji_translate_string((a)+1): (a)+1) */
#define TRANSLATE_ATTR(a) a
static bool bool_attr_is_true(TiXmlElement* elem, const char* attribute_name);