Commit cc6c02da authored by h2b's avatar h2b

Resource-bundle handling replaced by Utilib version.

parent 4b01fe8f
......@@ -21,18 +21,14 @@ import java.awt.{ Color => AwtColor, Dimension, FileDialog, Frame, Graphics, Gra
import java.awt.event.{ ActionEvent, ActionListener }
import java.awt.image.BufferedImage
import java.io.{ File, IOException }
import java.util.ResourceBundle
import scala.collection.JavaConverters.mapAsJavaMapConverter
import scala.util.Try
import de.h2b.scala.lib.simgraf.{ Color, Pixel }
import de.h2b.scala.lib.simgraf.driver.AwtScreenDriver.Localizer
import de.h2b.scala.lib.util.Logger
import de.h2b.scala.lib.util.config.BundleConfig
import javax.imageio.ImageIO
import javax.swing.{ JFrame, JMenu, JMenuBar, JMenuItem, JPanel, WindowConstants }
import scala.util.Success
import scala.util.Failure
/**
* Screen-driver implementation trait based on AWT (and some Swing).
......@@ -234,20 +230,17 @@ object AwtScreenDriver {
WritingFileException = Value
}
private final val BundleBaseName = classOf[AwtScreenDriver].getName
private val bundleTry =Try(ResourceBundle.getBundle(BundleBaseName))
if (bundleTry.isFailure) log.error(s"missing resource bundle: ${bundleTry.failed.get}")
private val bundleBaseName = classOf[AwtScreenDriver].getName
private val bundle = BundleConfig(bundleBaseName)
if (bundle.isEmpty) log.error(s"empty or missing resource bundle: $bundleBaseName")
import Key._
private[AwtScreenDriver] def local (key: Key): String = {
val default = key.toString()
return bundleTry match {
case Success(bundle) Try(bundle.getString(key.toString())) match {
case Success(str) str
case Failure(e) default
}
case Failure(e) default
return bundle.get(key.toString()) match {
case Some(str) str
case None default
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment