On 2010-05-06 at 17:23:01 [+0200], Michael Pfeiffer <michael.w.pfeiffer@xxxxxxxxx> wrote: > > Am 06.05.2010 um 16:08 schrieb Stephan Assmus: > > * The patch should ideally remove string composition: > > > > BString errorString; > > errorString << "The file '"; > > errorString fileName; > > errorString << "' cannot be found."; > > > > should become: > > > > char buffer[512]; > > snprintf(buffer, sizeof(buffer), TR("The file '%s' cannot be " > > "found."), fileName); > > > > For this case I prefer this solution: > > BString buffer(TR("The file '%file' cannot be found.")); > buffer.ReplaceFirst("%file", fileName); > > Because then you don't have to worry about the size of the buffer > and in case there is more than one substitution variable their > order can be defined by the translator. > > For example: > BString buffer(TR("%length %unit")); > buffer.ReplaceFirst("%length", "42"); > buffer.ReplaceFirst("%unit", "mm"); > > In the translation it could be "%unit %length", I admit that is not > a good example. Sounds good to me, thanks! Best regards, -Stephan