16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/babelish/xcode_macros.rb', line 16
def process(table, keys, = {})
keys.each do |key|
clean_key = key.gsub(' ', '')
clean_key.gsub!(/[[:punct:]]/, '_')
clean_key.gsub!('__', '_')
clean_key = clean_key[1..clean_key.size-1] if clean_key[0] == '_'
clean_key = clean_key[0..clean_key.size-2] if clean_key.size > 1 and clean_key[clean_key.size-1] == '_'
macro_name = "LS_#{clean_key.upcase}"
macro_name += "_#{table.upcase}" if table != "Localizable"
= [key]
@content << String.new("#define \#{macro_name} NSLocalizedStringFromTable(@\"\#{key}\",@\"\#{table}\",@\"\#{comment.to_s}\")\n EOS\n end\n @content\nend\n")
|