On Thu, 8 Jan 2009, Ævar Arnfjörð Bjarmason wrote:
The attached patch adds regex support to search, this solves trac
ticket #1864 [1][2], it adds a new "regex search" checkbox to the
search dialog below "case sensitive". If it's checked the pattern
given will be compiled as a regex with java.util.regex, e.g.:
Thanks for your work.
^hig.*?[way]+$ # Matches in both keys and values
^foo$:[bar] # Seperate regexes for the key and value
Patterns are case-insensitive by default, if the "case sensitive"
checkbox is checked they will be compiled with
Pattern.CASE_INSENSITIVE set (instead of lower casing the regex or
pattern which would screw things up).
If the user enters an invalid regex a dialog like this (by throwing
ParseError) shows up:
http://flickr.com/photos/avarab/3178963199/sizes/o/
It is of course translatable but the "full error" part comes directly
from Java's e.getMessage() exception method and may thus not be in the
same language as the rest of the JOSM interface. Although Java
implementations might have it localized. I think this is acceptable
given the limitations, the alternative is to provide a "regex
compilation failed" error without any further detail.
Some notes: You cannot add any text without tr(). It will not get
translated. Either you make a marktr() around or you add it directly at
the place where it is used and add a tr().
About Java messages: When they aren't dynamic, we can translate them as
well. Add a tr around the message text and have a
tr("could not get audio input stream from input URL"); // Java message loading
audio data
in the i18n/specialmessages.java.
If they are dynamic (e.g. contain variables), then we cannot translate
them. Your example looks like they are dynamic.
2. I couldn't submit it to trac, it gave me: "500 Internal Server
Error (Submission rejected as potential spam (Content contained
blacklisted patterns))"
Making a zip sometimes helps :-)
Ciao
--
http://www.dstoecker.eu/ (PGP key available)
_______________________________________________
josm-dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/josm-dev