webmcp
diff framework/env/__init.lua @ 0:9fdfb27f8e67
Version 1.0.0
author | jbe/bsw |
---|---|
date | Sun Oct 25 12:00:00 2009 +0100 (2009-10-25) |
parents | |
children | c6ef9991b911 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/framework/env/__init.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,16 @@ 1.4 +function _(text, replacements) 1.5 + local text = locale._get_translation_table()[text] or text 1.6 + if replacements then 1.7 + return ( 1.8 + string.gsub( 1.9 + text, 1.10 + "#{(.-)}", 1.11 + function (placeholder) 1.12 + return replacements[placeholder] 1.13 + end 1.14 + ) 1.15 + ) 1.16 + else 1.17 + return text 1.18 + end 1.19 +end