Changeset 6920 for trunk/gsdl/perllib/gsprintf.pm
- Timestamp:
- 2004-03-04T15:44:37+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/gsprintf.pm
r5613 r6920 39 39 40 40 # Look up all the strings in the dictionary 41 $text_string =~ s/(\{[^\}]+\})/& new_lookup_string($1)/eg;41 $text_string =~ s/(\{[^\}]+\})/&lookup_string("", $1)/eg; 42 42 43 43 # Resolve the string arguments using sprintf, then write out to the handle … … 46 46 47 47 48 sub new_lookup_string48 sub lookup_string 49 49 { 50 local ($ stringkey) = @_;50 local ($language, $stringkey) = @_; 51 51 52 52 # Load the default resource bundle 53 local %resourcebundle = &load_resource_bundle( "");53 local %resourcebundle = &load_resource_bundle($language); 54 54 55 55 # Return the text matching the key (or just the key, if no match was found) … … 109 109 110 110 111 # sub gsprintf112 # {113 # my ($handle, $verbosity_threshold, $text_string, @text_arguments) = @_;114 115 # # Return unless the required arguments were supplied116 # return unless (defined($handle) && defined($verbosity_threshold) && defined($text_string));117 118 # # Return if the verbosity threshold isn't met119 # return if (defined($verbosity) && $verbosity < $verbosity_threshold);120 121 # # Look up all the strings in the dictionary122 # $text_string =~ s/(\{[^\}]+\})/&new_lookup_string($1)/eg;123 124 # # Resolve the string arguments using sprintf, then write out to the handle125 # print $handle sprintf($text_string, @text_arguments);126 # }127 128 129 sub lookup_string130 {131 local ($language, $stringkey) = @_;132 133 $language = "" if !defined($language);134 135 # Load the appropriate resource bundle136 local %resourcebundle = &load_resource_bundle($language);137 138 # Return the text matching the key (or just the key, if no match was found)139 return $resourcebundle{$stringkey} || $stringkey;140 }141 142 143 111 1; 144 145
Note:
See TracChangeset
for help on using the changeset viewer.