[Rt-commit] rt branch, 4.4/attachment-error-i18n, created. rt-4.4.0-81-g1b52493

Shawn Moore shawn at bestpractical.com
Fri Apr 22 12:54:51 EDT 2016


The branch, 4.4/attachment-error-i18n has been created
        at  1b52493fc43e4326897e1c74026bdb0ccaa16416 (commit)

- Log -----------------------------------------------------------------
commit 1b52493fc43e4326897e1c74026bdb0ccaa16416
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Apr 22 16:42:41 2016 +0000

    Fix JS compile errors for translations with apostrophes
    
        This particularly affects Catalan since it translates "Error" as
        "S'ha produït un error". This breaks when we try to localize directly
        inside a JavaScript literal string like so:
    
            … + '<title><&|/l&>Error</&></title>' + …
    
        since Mason compiles this as JavaScript which has one too many quotes:
    
            … + '<title>S'ha produït un error</title>' + …
                ^        ^                           ^
    
        The solution is to switch this line to use our JavaScript-based
        localization engine which avoids quoting problems, since Mason
        is no longer directly involved:
    
            … + '<title>' + loc_key('error') + '</title>' + …
    
         This only affects single-quoted strings since <&|/l&> escapes
         double quotes (and other HTML meta characters).
    
         This commit fixes the similar "Remove" and "Check" i18n
         interpolations in the same component, though as of this commit
         no translations include apostrophes for either msgid.
    
    Fixes: I#31864

diff --git a/share/html/Elements/JavascriptConfig b/share/html/Elements/JavascriptConfig
index 2a135b3..53046b4 100644
--- a/share/html/Elements/JavascriptConfig
+++ b/share/html/Elements/JavascriptConfig
@@ -66,6 +66,9 @@ my $Catalog = {
     quote_in_filename => "Filenames with double quotes can not be uploaded.", #loc
     attachment_warning_regex => "\\battach", #loc
     shortcut_help_error => "Unable to open shortcut help. Reason:", #loc
+    error => "Error", #loc
+    check => "Check", #loc
+    remove => "Remove", #loc
 };
 $_ = loc($_) for values %$Catalog;
 
diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index 32217c1..ba126a5 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -74,7 +74,7 @@ jQuery( function() {
             '<div class="dz-preview dz-file-preview">' +
             '    <div class="dz-remove-mark pointer-events" data-dz-remove>' +
             '        <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">' +
-            '            <title><&|/l&>Remove</&></title>' +
+            '            <title>' + loc_key('remove') + '</title>' +
             '            <defs></defs>' +
             '            <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">' +
             '                <g style="fill:#d9534f" id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">' +
@@ -95,7 +95,7 @@ jQuery( function() {
             '    <div class="dz-error-message"><span data-dz-errormessage></span></div>' +
             '    <div class="dz-success-mark">' +
             '        <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">' + 
-            '            <title><&|/l&>Check</&></title>' +
+            '            <title>' + loc_key('check') + </title>' +
             '            <defs></defs>' +
             '            <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">' +
             '                <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123' +
@@ -107,7 +107,7 @@ jQuery( function() {
             '    </div>' +
             '    <div class="dz-error-mark">' +
             '        <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">' +
-            '            <title><&|/l&>Error</&></title>' +
+            '            <title>' + loc_key('error') + '</title>' +
             '            <defs></defs>' +
             '            <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">' +
             '                <g id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">' +

-----------------------------------------------------------------------


More information about the rt-commit mailing list