[Rt-commit] rt branch, 4.2/concise-lifecycle-actions, created. rt-4.2.3-61-g506b41c
Alex Vandiver
alexmv at bestpractical.com
Tue Mar 25 11:45:31 EDT 2014
The branch, 4.2/concise-lifecycle-actions has been created
at 506b41c966cc4e9cbc43a5566df1d4092c910300 (commit)
- Log -----------------------------------------------------------------
commit d7b9355dd8222471a97f0f3769015aa266839312
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Mar 25 11:44:15 2014 -0400
Add a new loc form, loc{key}, which localizes the value of that key
diff --git a/devel/tools/extract-message-catalog b/devel/tools/extract-message-catalog
index 80eff1b..fc09c4f 100755
--- a/devel/tools/extract-message-catalog
+++ b/devel/tools/extract-message-catalog
@@ -281,10 +281,29 @@ sub extract_strings_from_code {
push @{ $FILECAT{$val} }, [ $filename, $line, '' ];
}
+ # Specific key foo => "...", #loc{foo}
+ $line = 1;
+ pos($_) = 0;
+ while (m/\G(.*?(\w+|$re_delim)\s*=>\s*($re_delim).*?\#$re_space_wo_nl*loc\{\2\}$re_space_wo_nl*)$/smgo) {
+ my ( $all, $key, $val ) = ( $1, $2, $10 );
+ $line += ( $all =~ tr/\n/\n/ );
+ $seen{$line}++;
+ unless ( defined $key && defined $val ) {
+ warn "Couldn't process loc_pair at $filename:$line:\n key«$key»\n val«$val»\n";
+ next;
+ }
+ $key =~ s/^(['"])(.*)\1$/$2/g; # dequote potentially quoted string
+ $val = substr($val, 1, -1); # dequote always quoted string
+ $key =~ s/\\(['"])/$1/g;
+ $val =~ s/\\(['"])/$1/g;
+ push @{ $FILECAT{$key} }, [ $filename, $line, '' ];
+ push @{ $FILECAT{$val} }, [ $filename, $line, '' ];
+ }
+
# Check for ones we missed
$line = 1;
pos($_) = 0;
- while (m/\G(.*? \# $re_space_wo_nl* (loc (_\w+|\(\))?) $re_space_wo_nl* $)/smgox) {
+ while (m/\G(.*? \# $re_space_wo_nl* (loc (_\w+|\(\)|{$re_delim})?) $re_space_wo_nl* $)/smgox) {
my ($all, $loc_type) = ($1, $2);
$line += ( $all =~ tr/\n/\n/ );
next if $seen{$line};
diff --git a/docs/hacking.pod b/docs/hacking.pod
index a3280c9..23ce51e 100644
--- a/docs/hacking.pod
+++ b/docs/hacking.pod
@@ -153,8 +153,14 @@ C<#loc_left_pair> is used for declaring that the I<key> of a
particular C<< key => value >> pair is translatable. This is of
very limited usefulness.
-C<#loc_right_pair> does NOT exist. C<#loc> works in such cases since
-its parser does not extend beyond the string at the end of a line.
+C<#loc_right_pair> does NOT exist. C<#loc> works in such cases since its
+parser does not extend beyond the string at the end of a line. However,
+if the string is I<not> at the end of the line, C<#loc{word}> declares
+that the value associated with the key I<word> (earlier on the same
+line) is to be loc'd. This is useful for inline hashes:
+
+ # Note the string "baz" is to be loc'd
+ foo => { bar => "baz", troz => "zort" }, # loc{bar}
=head1 Development tips
commit 506b41c966cc4e9cbc43a5566df1d4092c910300
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Mar 25 11:44:37 2014 -0400
Use the new loc{key} form to compress the default lifecycles
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 8ebb13b..b40af5c 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2767,49 +2767,17 @@ Set(%Lifecycles,
'* -> *' => 'ModifyTicket',
},
actions => [
- 'new -> open' => {
- label => 'Open It', # loc
- update => 'Respond',
- },
- 'new -> resolved' => {
- label => 'Resolve', # loc
- update => 'Comment',
- },
- 'new -> rejected' => {
- label => 'Reject', # loc
- update => 'Respond',
- },
- 'new -> deleted' => {
- label => 'Delete', # loc
- },
-
- 'open -> stalled' => {
- label => 'Stall', # loc
- update => 'Comment',
- },
- 'open -> resolved' => {
- label => 'Resolve', # loc
- update => 'Comment',
- },
- 'open -> rejected' => {
- label => 'Reject', # loc
- update => 'Respond',
- },
-
- 'stalled -> open' => {
- label => 'Open It', # loc
- },
- 'resolved -> open' => {
- label => 'Re-open', # loc
- update => 'Comment',
- },
- 'rejected -> open' => {
- label => 'Re-open', # loc
- update => 'Comment',
- },
- 'deleted -> open' => {
- label => 'Undelete', # loc
- },
+ 'new -> open' => { label => 'Open It', update => 'Respond' }, # loc{label}
+ 'new -> resolved' => { label => 'Resolve', update => 'Comment' }, # loc{label}
+ 'new -> rejected' => { label => 'Reject', update => 'Respond' }, # loc{label}
+ 'new -> deleted' => { label => 'Delete', }, # loc{label}
+ 'open -> stalled' => { label => 'Stall', update => 'Comment' }, # loc{label}
+ 'open -> resolved' => { label => 'Resolve', update => 'Comment' }, # loc{label}
+ 'open -> rejected' => { label => 'Reject', update => 'Respond' }, # loc{label}
+ 'stalled -> open' => { label => 'Open It', }, # loc{label}
+ 'resolved -> open' => { label => 'Re-open', update => 'Comment' }, # loc{label}
+ 'rejected -> open' => { label => 'Re-open', update => 'Comment' }, # loc{label}
+ 'deleted -> open' => { label => 'Undelete', }, # loc{label}
],
},
# don't change lifecyle of the approvals, they are not capable to deal with
@@ -2843,49 +2811,17 @@ Set(%Lifecycles,
'* -> *' => 'ModifyTicket',
},
actions => [
- 'new -> open' => {
- label => 'Open It', # loc
- update => 'Respond',
- },
- 'new -> resolved' => {
- label => 'Resolve', # loc
- update => 'Comment',
- },
- 'new -> rejected' => {
- label => 'Reject', # loc
- update => 'Respond',
- },
- 'new -> deleted' => {
- label => 'Delete', # loc
- },
-
- 'open -> stalled' => {
- label => 'Stall', # loc
- update => 'Comment',
- },
- 'open -> resolved' => {
- label => 'Resolve', # loc
- update => 'Comment',
- },
- 'open -> rejected' => {
- label => 'Reject', # loc
- update => 'Respond',
- },
-
- 'stalled -> open' => {
- label => 'Open It', # loc
- },
- 'resolved -> open' => {
- label => 'Re-open', # loc
- update => 'Comment',
- },
- 'rejected -> open' => {
- label => 'Re-open', # loc
- update => 'Comment',
- },
- 'deleted -> open' => {
- label => 'Undelete', # loc
- },
+ 'new -> open' => { label => 'Open It', update => 'Respond' }, # loc{label}
+ 'new -> resolved' => { label => 'Resolve', update => 'Comment' }, # loc{label}
+ 'new -> rejected' => { label => 'Reject', update => 'Respond' }, # loc{label}
+ 'new -> deleted' => { label => 'Delete', }, # loc{label}
+ 'open -> stalled' => { label => 'Stall', update => 'Comment' }, # loc{label}
+ 'open -> resolved' => { label => 'Resolve', update => 'Comment' }, # loc{label}
+ 'open -> rejected' => { label => 'Reject', update => 'Respond' }, # loc{label}
+ 'stalled -> open' => { label => 'Open It', }, # loc{label}
+ 'resolved -> open' => { label => 'Re-open', update => 'Comment' }, # loc{label}
+ 'rejected -> open' => { label => 'Re-open', update => 'Comment' }, # loc{label}
+ 'deleted -> open' => { label => 'Undelete', }, # loc{label}
],
},
);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list