[meld] filediff, const: Extract newline translations for use elsewhere



commit 64a9f5fc4e63c93ecdc89a0ca69eadae9ebeb42c
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Feb 8 08:57:17 2015 +1000

    filediff, const: Extract newline translations for use elsewhere

 meld/const.py    |    8 ++++++++
 meld/filediff.py |    8 ++++----
 po/POTFILES.in   |    1 +
 3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/meld/const.py b/meld/const.py
index 6388996..c7d72cb 100644
--- a/meld/const.py
+++ b/meld/const.py
@@ -1,5 +1,13 @@
 
+from meld.conf import _
+
 # Chunk action mode, set by filediff and used in gutterrendererchunk
 MODE_REPLACE = 0
 MODE_DELETE = 1
 MODE_INSERT = 2
+
+NEWLINES = {
+    '\n': _("UNIX (LF)"),
+    '\r\n': _("DOS/Windows (CR-LF)"),
+    '\r': _("Mac OS (CR)"),
+}
diff --git a/meld/filediff.py b/meld/filediff.py
index ccff023..5d516c7 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -45,7 +45,7 @@ from . import undo
 from .ui import findbar
 from .ui import gnomeglade
 
-from meld.const import MODE_REPLACE, MODE_DELETE, MODE_INSERT
+from meld.const import MODE_REPLACE, MODE_DELETE, MODE_INSERT, NEWLINES
 from meld.settings import bind_settings, meldsettings, settings
 from .util.compat import text_type
 from meld.sourceview import LanguageManager
@@ -1687,9 +1687,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                     text = text.replace("\n", bufdata.newlines)
             else:
                 buttons = {
-                    '\n': ("UNIX (LF)", 0),
-                    '\r\n': ("DOS/Windows (CR-LF)", 1),
-                    '\r': ("Mac OS (CR)", 2),
+                    '\n': (NEWLINES['\n'], 0),
+                    '\r\n': (NEWLINES['\r\n'], 1),
+                    '\r': (NEWLINES['\r'], 2),
                 }
                 dialog_buttons = [(_("_Cancel"), Gtk.ResponseType.CANCEL)]
                 dialog_buttons += [buttons[b] for b in bufdata.newlines]
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5792a58..fcc454e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -13,6 +13,7 @@ data/org.gnome.meld.gschema.xml
 [type: gettext/glade]data/ui/preferences.ui
 [type: gettext/glade]data/ui/tab-placeholder.ui
 [type: gettext/glade]data/ui/vcview.ui
+meld/const.py
 meld/dirdiff.py
 meld/filediff.py
 meld/filemerge.py


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]