Patchwork [stable] hgweb, i18n: avoid parameterized search mode description

login
register
mail settings
Submitter Wagner Bruna
Date Nov. 4, 2013, 1:48 p.m.
Message ID <82ca1e56b8a5c246d99a.1383572928@mwagner.paulista.local>
Download mbox | patch
Permalink /patch/2847/
State Superseded, archived
Headers show

Comments

Wagner Bruna - Nov. 4, 2013, 1:48 p.m.
# HG changeset patch
# User Wagner Bruna <wbruna@softwareexpress.com.br>
# Date 1383572580 7200
#      Seg Nov 04 11:43:00 2013 -0200
# Branch stable
# Node ID 82ca1e56b8a5c246d99a320f18b8f5a11f010391
# Parent  84755bf5946968fdb7d8bd0951b9238346ef268e
hgweb, i18n: avoid parameterized search mode description
Matt Mackall - Nov. 4, 2013, 6:10 p.m.
On Mon, 2013-11-04 at 11:48 -0200, Wagner Bruna wrote:
> # HG changeset patch
> # User Wagner Bruna <wbruna@softwareexpress.com.br>
> # Date 1383572580 7200
> #      Seg Nov 04 11:43:00 2013 -0200
> # Branch stable
> # Node ID 82ca1e56b8a5c246d99a320f18b8f5a11f010391
> # Parent  84755bf5946968fdb7d8bd0951b9238346ef268e
> hgweb, i18n: avoid parameterized search mode description

???

> diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py
> +++ b/mercurial/hgweb/webcommands.py
> @@ -151,9 +151,15 @@ def _search(web, req, tmpl):
>              yield web.repo[r]
>  
>      searchfuncs = {
> -        MODE_REVISION: (revsearch, _('exact revision search')),
> -        MODE_KEYWORD: (keywordsearch, _('literal keyword search')),
> -        MODE_REVSET: (revsetsearch, _('revset expression search')),
> +        MODE_REVISION: (revsearch,
> +                        _('Assuming exact revision search.'),
> +                        _('Use exact revision search instead.')),
> +        MODE_KEYWORD: (keywordsearch,
> +                       _('Assuming literal keyword search.'),
> +                       _('Use literal keyword search instead.')),
> +        MODE_REVSET: (revsetsearch,
> +                       _('Assuming revset expression search.'),
> +                       _('Use revset expression search instead.')),
>      }
>  
>      def getsearchmode(query):
> @@ -243,12 +249,12 @@ def _search(web, req, tmpl):
>  
>      if 'forcekw' in req.form:
>          showforcekw = ''
> -        showunforcekw = searchfuncs[mode][1]
> +        showunforcekw = searchfuncs[mode][2]
>          mode = MODE_KEYWORD
>          funcarg = query
>      else:
>          if mode != MODE_KEYWORD:
> -            showforcekw = searchfuncs[MODE_KEYWORD][1]
> +            showforcekw = searchfuncs[MODE_KEYWORD][2]
>          else:
>              showforcekw = ''
>          showunforcekw = ''
> diff --git a/mercurial/templates/paper/search.tmpl b/mercurial/templates/paper/search.tmpl
> --- a/mercurial/templates/paper/search.tmpl
> +++ b/mercurial/templates/paper/search.tmpl
> @@ -24,11 +24,11 @@
>  <h3>searching for '{query|escape}'</h3>
>  
>  <p>
> -Assuming {modedesc}.
> +{modedesc}
>  {if(showforcekw, '<a href="{url|urlescape}log?rev={query|urlescape}&forcekw=1">
> -Use {showforcekw}</a> instead.')}
> +{showforcekw}</a>')}
>  {if(showunforcekw, '<a href="{url|urlescape}log?rev={query|urlescape}">
> -Use {showunforcekw}</a> instead.')}
> +{showunforcekw}</a>')}
>  </p>
>  
>  <form class="search" action="{url|urlescape}log">
> diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t
> +++ b/tests/test-hgweb-commands.t
> @@ -570,7 +570,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "tip^"
> -  # Mode revset expression search
> +  # Mode Assuming revset expression search.
>    
>    changeset:   1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
>    revision:    2
> @@ -587,7 +587,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "last(all(),2)^"
> -  # Mode revset expression search
> +  # Mode Assuming revset expression search.
>    
>    changeset:   1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
>    revision:    2
> @@ -611,7 +611,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "last(all(,2)^"
> -  # Mode literal keyword search
> +  # Mode Assuming literal keyword search.
>    
>    
>    $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'log?rev=last(al(),2)^&style=raw'
> @@ -621,7 +621,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "last(al(),2)^"
> -  # Mode literal keyword search
> +  # Mode Assuming literal keyword search.
>    
>    
>    $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'log?rev=bookmark(anotherthing)&style=raw'
> @@ -631,7 +631,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "bookmark(anotherthing)"
> -  # Mode revset expression search
> +  # Mode Assuming revset expression search.
>    
>    changeset:   2ef0ac749a14e4f57a5a822464a0902c6f7f448f
>    revision:    0
> @@ -649,7 +649,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "bookmark(abc)"
> -  # Mode literal keyword search
> +  # Mode Assuming literal keyword search.
>    
>    
>    $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'log?rev=deadbeef:&style=raw'
> @@ -659,7 +659,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "deadbeef:"
> -  # Mode literal keyword search
> +  # Mode Assuming literal keyword search.
>    
>    
>  
> @@ -670,7 +670,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "user("test")"
> -  # Mode revset expression search
> +  # Mode Assuming revset expression search.
>    
>    changeset:   cad8025a2e87f88c06259790adfa15acb4080123
>    revision:    3
> @@ -711,7 +711,7 @@ Search with revset syntax
>    # HG changesets search
>    # Node ID cad8025a2e87f88c06259790adfa15acb4080123
>    # Query "user("re:test")"
> -  # Mode literal keyword search
> +  # Mode Assuming literal keyword search.
>    
>    
>  
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Wagner Bruna - Nov. 4, 2013, 7:11 p.m.
Em 04-11-2013 16:10, Matt Mackall escreveu:
> On Mon, 2013-11-04 at 11:48 -0200, Wagner Bruna wrote:
>> # HG changeset patch
>> # User Wagner Bruna <wbruna@softwareexpress.com.br>
>> # Date 1383572580 7200
>> #      Seg Nov 04 11:43:00 2013 -0200
>> # Branch stable
>> # Node ID 82ca1e56b8a5c246d99a320f18b8f5a11f010391
>> # Parent  84755bf5946968fdb7d8bd0951b9238346ef268e
>> hgweb, i18n: avoid parameterized search mode description
> 
> ???

...

Let me get this out of the way first: IMHO it's EXTREMELY inefficient to
approach a communication problem with further non-communication.

So, I *guess* this patch description, together with the template change below,
isn't enough to remind our fellow developers yet again that we can't translate
English phrases a bit at a time. Very well; I'll give it another try.

Regards,
Wagner

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -151,9 +151,15 @@  def _search(web, req, tmpl):
             yield web.repo[r]
 
     searchfuncs = {
-        MODE_REVISION: (revsearch, _('exact revision search')),
-        MODE_KEYWORD: (keywordsearch, _('literal keyword search')),
-        MODE_REVSET: (revsetsearch, _('revset expression search')),
+        MODE_REVISION: (revsearch,
+                        _('Assuming exact revision search.'),
+                        _('Use exact revision search instead.')),
+        MODE_KEYWORD: (keywordsearch,
+                       _('Assuming literal keyword search.'),
+                       _('Use literal keyword search instead.')),
+        MODE_REVSET: (revsetsearch,
+                       _('Assuming revset expression search.'),
+                       _('Use revset expression search instead.')),
     }
 
     def getsearchmode(query):
@@ -243,12 +249,12 @@  def _search(web, req, tmpl):
 
     if 'forcekw' in req.form:
         showforcekw = ''
-        showunforcekw = searchfuncs[mode][1]
+        showunforcekw = searchfuncs[mode][2]
         mode = MODE_KEYWORD
         funcarg = query
     else:
         if mode != MODE_KEYWORD:
-            showforcekw = searchfuncs[MODE_KEYWORD][1]
+            showforcekw = searchfuncs[MODE_KEYWORD][2]
         else:
             showforcekw = ''
         showunforcekw = ''
diff --git a/mercurial/templates/paper/search.tmpl b/mercurial/templates/paper/search.tmpl
--- a/mercurial/templates/paper/search.tmpl
+++ b/mercurial/templates/paper/search.tmpl
@@ -24,11 +24,11 @@ 
 <h3>searching for '{query|escape}'</h3>
 
 <p>
-Assuming {modedesc}.
+{modedesc}
 {if(showforcekw, '<a href="{url|urlescape}log?rev={query|urlescape}&forcekw=1">
-Use {showforcekw}</a> instead.')}
+{showforcekw}</a>')}
 {if(showunforcekw, '<a href="{url|urlescape}log?rev={query|urlescape}">
-Use {showunforcekw}</a> instead.')}
+{showunforcekw}</a>')}
 </p>
 
 <form class="search" action="{url|urlescape}log">
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -570,7 +570,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "tip^"
-  # Mode revset expression search
+  # Mode Assuming revset expression search.
   
   changeset:   1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
   revision:    2
@@ -587,7 +587,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "last(all(),2)^"
-  # Mode revset expression search
+  # Mode Assuming revset expression search.
   
   changeset:   1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
   revision:    2
@@ -611,7 +611,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "last(all(,2)^"
-  # Mode literal keyword search
+  # Mode Assuming literal keyword search.
   
   
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'log?rev=last(al(),2)^&style=raw'
@@ -621,7 +621,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "last(al(),2)^"
-  # Mode literal keyword search
+  # Mode Assuming literal keyword search.
   
   
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'log?rev=bookmark(anotherthing)&style=raw'
@@ -631,7 +631,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "bookmark(anotherthing)"
-  # Mode revset expression search
+  # Mode Assuming revset expression search.
   
   changeset:   2ef0ac749a14e4f57a5a822464a0902c6f7f448f
   revision:    0
@@ -649,7 +649,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "bookmark(abc)"
-  # Mode literal keyword search
+  # Mode Assuming literal keyword search.
   
   
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'log?rev=deadbeef:&style=raw'
@@ -659,7 +659,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "deadbeef:"
-  # Mode literal keyword search
+  # Mode Assuming literal keyword search.
   
   
 
@@ -670,7 +670,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "user("test")"
-  # Mode revset expression search
+  # Mode Assuming revset expression search.
   
   changeset:   cad8025a2e87f88c06259790adfa15acb4080123
   revision:    3
@@ -711,7 +711,7 @@  Search with revset syntax
   # HG changesets search
   # Node ID cad8025a2e87f88c06259790adfa15acb4080123
   # Query "user("re:test")"
-  # Mode literal keyword search
+  # Mode Assuming literal keyword search.