[Jifty-commit] r5842 - jifty/trunk/lib/Jifty/Plugin

Jifty commits jifty-commit at lists.jifty.org
Mon Sep 15 22:06:41 EDT 2008


Author: sunnavy
Date: Mon Sep 15 22:06:41 2008
New Revision: 5842

Modified:
   jifty/trunk/lib/Jifty/Plugin/I18N.pm

Log:
tiny refactor

Modified: jifty/trunk/lib/Jifty/Plugin/I18N.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/I18N.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/I18N.pm	Mon Sep 15 22:06:41 2008
@@ -88,20 +88,33 @@
         }
     }
 
-    open my $fh, '<:encoding(utf-8)',
+    if (
+        open my $fh,
+        '<:encoding(utf-8)',
         Jifty::Util->absolute_path(
-        File::Spec->catdir(
-            Jifty->config->framework('Web')->{StaticRoot},
-            "js/dict/$current_lang.json" ))
-        or Jifty->log->error("Can't find dictionary file $current_lang.json: $!");
+            File::Spec->catdir(
+                Jifty->config->framework('Web')->{StaticRoot},
+                "js/dict/$current_lang.json"
+            )
+        )
+      )
+    {
+        local $/;
+        my $inline_dict = <$fh> || '{}';
 
-    local $/;
-    my $inline_dict = <$fh> || '{}';
-    # js l10n init
-    Jifty->web->out(qq{<script type="text/javascript">
+        # js l10n init
+        Jifty->web->out(
+            qq{<script type="text/javascript">
 Localization.dict_path = '/static/js/dict';
 Localization.dict = $inline_dict;
-</script>});
+</script>}
+        );
+
+    }
+    else {
+        Jifty->log->error("Can't find dictionary file $current_lang.json: $!");
+    }
+
 }
 
 1;


More information about the Jifty-commit mailing list