So, I have a small translation system configured for my application, where we create a list of all the lines that are marked as translatable, dump that in CSV as a translation template, and then the translator fills in the next column with translations.
The problem I'm trying to solve is how to extract a bunch of tagged lines from the code base to automate the creation of a translation template.
An example C # line of code looks something like this:
textBoxName.Text = string.Format(Translate.tr("Create {0}"), NextAutoName());
And C ++ will look like this:
info_out << tr( L"Grip weights range from {0} to {1}" )(low_weight)(high_weight) << endl;
On the C ++ side, when constructing a list of strings for generating a template, the C ++ parser is used (see my previous question ), which is performed as part of external assemblies on all C ++ code in the project. Basically, any string placed in a tr () call is automatically retrieved.
Is there a better solution with C # than writing another parser? I would like a list of lines that are created at compile time, or one that I can get at runtime. A List<string> would be great.
I would like to keep the same translation file format, because it simplifies the coordination of the two sides. As expected, we use many lines.
Currently, it’s much more convenient to update the translation template in c ++ - I just need to make sure that the lines I want to translate are wrapped in tr (), and the parser processes the rest. In C #, I manually check all the lines and update the dummy function on the C ++ side with new lines. I am approaching the break and just writing another parser. I was hoping C #, with its high-level features, could do a better job here.