| 209 | | if ($tmpl =~ /\.yaml$/) { |
| | 209 | if ($tmpl =~ /(services|streams)\.yaml$/) { |
| | 210 | while ($text =~ /\s*(?:description|ident_hint|label|name):\s*(.+)/g) { |
| | 211 | my($msg, %args); |
| | 212 | my $trans = ''; |
| | 213 | $args{phrase} = $1; |
| | 214 | $args{phrase} =~ s/(^'+|'+$)//; |
| | 215 | $args{phrase} =~ s/'/\\'/g; |
| | 216 | if ($trans eq '' && $conv{$args{phrase}}) { |
| | 217 | $trans = $conv{$args{phrase}}; |
| | 218 | $is_used{$args{phrase}} = 1; |
| | 219 | } |
| | 220 | $trans =~ s/([^\\]?)'/$1\\'/g; |
| | 221 | next if ($phrase{$args{phrase}}); |
| | 222 | $phrase{$args{phrase}} = 1; |
| | 223 | my $q = "'"; |
| | 224 | if ($args{phrase} =~ /\\n/) { |
| | 225 | $q = '"'; |
| | 226 | } |
| | 227 | if ($trans) { |
| | 228 | printf "\t$q%s$q => '%s',\n", $args{phrase}, $trans; # Print out the translation if there was an existing one |
| | 229 | } else { |
| | 230 | $trans = $lconv{lc $args{phrase}} || ''; |
| | 231 | my $reason = $trans ? "Case" : "New"; # New translation, or just different case? |
| | 232 | printf "\t$q%s$q => '%s', # Translate - $reason\n", $args{phrase}, $trans; # Print out the translation if there was an existing one based on the lowercase string, else empty |
| | 233 | } |
| | 234 | } |
| | 235 | } |
| | 236 | elsif ($tmpl =~ /\.yaml$/) { |