#7169: A DiskUsage localization patch ------------------------------+-------------------------------------------- Reporter: Karvjorm | Owner: siarzhuk Type: enhancement | Status: assigned Priority: normal | Milestone: R1 Component: | Version: R1/alpha2 Applications/DiskUsage | Keywords: DiskUsage localization patch Resolution: | Has a Patch: 1 Blocked By: | Blocking: Platform: All | ------------------------------+-------------------------------------------- Comment (by Karvjorm): Replying to [comment:2 siarzhuk]: > From my point of view, this patch is unacceptable. The problem is a way the DiskUsage application work with strings. Typical Haiku applications, as you know, use string literals in the source code. But DiskUsage uses string resources to store this info. Look into DiskUsage.rdef for details. Frankly speaking the work with resources in Haiku is not so perfect as other parts of it. Another possible problem is a memory leaks - I see no free calls for loaded string resources. And last problem - is the way you trying to workaround the translation task: > > {{{ > > kVolMenuLabel = LoadString("STR_VM_LABEL"); > + if (strncmp(kVolMenuLabel, "Volume:", sizeof("Volume:")) == 0) > + kVolMenuLabel = (char *)B_TRANSLATE("Volume:"); > + > }}} > > > it looks like an OVER-complication. :-( > > So I propose you to move away mentioned string resources from DiskUsage.rdef, and replace corresponding calls of "LoadString" in Common.cpp with those strings wrapped in B_TRANSLATE macros. > > PS: In my opinion, "color" and "int" can be also moved from DiskUsage.rdef to Common.cpp. It makes the code a bit more simpler. ;-) OK, I tried to do the localization work without large refactoring work and noticed that those strings that are target for the localization were loaded from the resource file. So I decided to localize those dynamically on-the-fly after there were loaded to the application. I did not know any other way (except refactoring the code and inserting strings to source code and ignoring strings in the resource file). But maybe I have to do it then? -- Ticket URL: <http://dev.haiku-os.org/ticket/7169#comment:3> Haiku <http://dev.haiku-os.org> Haiku - the operating system.