mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
localization pattern
This commit is contained in:
@@ -803,6 +803,13 @@ error:
|
|||||||
To resolve this, add:
|
To resolve this, add:
|
||||||
depends on: %s %s
|
depends on: %s %s
|
||||||
|
|
||||||
|
# Image import
|
||||||
|
import not found: File not found: '%s'
|
||||||
|
can't import image without set: Must first save or load a set file before importing file: '%s'
|
||||||
|
can't create file stream: Failed to create file stream: '%s'
|
||||||
|
can't write image to set: Failed to write image to set: '%s'
|
||||||
|
can't import image: Failed to import image: '%s'
|
||||||
|
|
||||||
# Script stuff
|
# Script stuff
|
||||||
has no member: %s has no member '%s'
|
has no member: %s has no member '%s'
|
||||||
can't convert: Can't convert from %s to %s
|
can't convert: Can't convert from %s to %s
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ Load an image from outside the data folder. Intended for use from the CLI.
|
|||||||
| @input@ [[type:string]] Full path of the image to load
|
| @input@ [[type:string]] Full path of the image to load
|
||||||
|
|
||||||
--Examples--
|
--Examples--
|
||||||
> import_image("D:/Art/Ajani.png")
|
> new_card([image: import_image("D:/Art/Ajani.png"), card_color: "green"])
|
||||||
|
|||||||
@@ -521,34 +521,28 @@ bool ImageValueToImage::operator == (const GeneratedImage& that) const {
|
|||||||
|
|
||||||
Image ExternalImage::generate(const Options& opt) const {
|
Image ExternalImage::generate(const Options& opt) const {
|
||||||
wxFileName fname(filepath, wxPATH_UNIX);
|
wxFileName fname(filepath, wxPATH_UNIX);
|
||||||
|
String filePathString = fname.GetAbsolutePath();
|
||||||
|
|
||||||
// has a pre-existing .mse-set file been loaded?
|
// has a pre-existing .mse-set file been loaded?
|
||||||
if (opt.local_package->needSaveAs())
|
if (opt.local_package->needSaveAs()) throw ScriptError(_ERROR_1_("can't import image without set", filePathString));
|
||||||
throw ScriptError(_("Cannot import an image without first saving/loading a set file."));
|
|
||||||
|
|
||||||
// does the file pointed to by filepath exist?
|
// does the file pointed to by filepath exist?
|
||||||
if (!fname.FileExists()) {
|
if (!fname.FileExists()) throw ScriptError(_ERROR_1_("import not found", filePathString));
|
||||||
String filePathString = fname.GetAbsolutePath().ToStdString();
|
|
||||||
throw ScriptError(format_string(_("The file '%s' was not found."),filePathString));
|
|
||||||
}
|
|
||||||
|
|
||||||
String fileExt = fname.GetExt();
|
String fileExt = fname.GetExt();
|
||||||
wxBitmapType bitmapType;
|
wxBitmapType bitmapType;
|
||||||
if (fileExt == _("png"))
|
if (fileExt == _("png")) bitmapType = wxBITMAP_TYPE_PNG;
|
||||||
bitmapType = wxBITMAP_TYPE_PNG;
|
else if (fileExt == _("jpg") || fileExt == _("jpeg")) bitmapType = wxBITMAP_TYPE_JPEG;
|
||||||
else if (fileExt == _("jpg"))
|
else bitmapType = wxBITMAP_TYPE_BMP;
|
||||||
bitmapType = wxBITMAP_TYPE_JPEG;
|
|
||||||
else
|
|
||||||
bitmapType = wxBITMAP_TYPE_BMP;
|
|
||||||
|
|
||||||
// does the file exist in the package?
|
// does the file exist in the package?
|
||||||
String fileNameNoExtension = fname.GetName();
|
String fileNameNoExtension = fname.GetName();
|
||||||
if (!opt.local_package->existsIn(fileNameNoExtension)) {
|
if (!opt.local_package->existsIn(fileNameNoExtension)) {
|
||||||
auto outStream = opt.local_package->openOut(fileNameNoExtension);
|
auto outStream = opt.local_package->openOut(fileNameNoExtension);
|
||||||
wxFileInputStream inStream = wxFileInputStream(filepath.ToStdString());
|
wxFileInputStream inStream = wxFileInputStream(filepath.ToStdString());
|
||||||
if (!inStream.IsOk()) throw ScriptError(_("Failed to create file stream."));
|
if (!inStream.IsOk()) throw ScriptError(_ERROR_1_("can't create file stream", filePathString));
|
||||||
outStream->Write(inStream);
|
outStream->Write(inStream);
|
||||||
if (!outStream->IsOk()) throw ScriptError(_("Failed to write image to set."));
|
if (!outStream->IsOk()) throw ScriptError(_ERROR_1_("can't write image to set", filePathString));
|
||||||
outStream->Close();
|
outStream->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +552,7 @@ Image ExternalImage::generate(const Options& opt) const {
|
|||||||
auto imageInputStream = opt.local_package->openIn(fileNameNoExtension);
|
auto imageInputStream = opt.local_package->openIn(fileNameNoExtension);
|
||||||
Image img(*imageInputStream.get(), bitmapType);
|
Image img(*imageInputStream.get(), bitmapType);
|
||||||
|
|
||||||
if (!img.IsOk()) throw ScriptError(_("The image could not be created."));
|
if (!img.IsOk()) throw ScriptError(_ERROR_1_("can't import image", filePathString));
|
||||||
|
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user