nitc :: StringFinder :: defaultinit
private class StringFinder
super Visitor
# Strings in the file, used to generate .pot and .po files
var strings = new HashMap[String, PObject]
# Domain of the strings to internationalize
var domain: String
# Location of the languages file
var languages_location: String
# Context for the visitor, used only for the parse_expr
var toolcontext: ToolContext
# The module we are working on
var amodule: AModule
redef fun visit(n)
do
n.accept_string_finder(self)
n.visit_all(self)
end
redef fun enter_visit(e) do
if e isa AAnnotation then return
super
end
# Adds a String to the list of strings of the module
#
# The string needs to be pre-formatted to C standards (escape_to_c)
fun add_string(s: String, loc: Location) do
var locstr = "{amodule.mmodule.mgroup.name}::{amodule.mmodule.name} {loc.line_start}--{loc.column_start}:{loc.column_end}"
if not strings.has_key(s) then
var po = new PObject([locstr], s, "")
strings[s] = po
else
strings[s].locations.push locstr
end
end
end
src/frontend/i18n_phase.nit:83,1--124,3