c# - How to Handle String Literals in Resource (.resx) Files -


All, I've been learning a lot about the recent use of localization and resource files (.resx). For any particular code, I have for each WinForm. (For another object wire [column name, etc.] and a .resx (and consolidated localized version DE-DE.resx etc.) for a user message are displayed in the message box etc.). I have no problem with object strings, but occasionally, but for the message I have the following problem ...

Take a few "string" messages (23 hits in 3 files) of 'message' . To create such a message where the message is at the beginning of a tab-space, I

  string.format ("\ t search \" {0} \ "({1} {2} files Hit code) \ n ", strSearchString, NTotalHits, nNumberOfFiles);   

The problem is now, when I enter the string "\ t search \" {0} \ "({1} contains hits {2}) \ n" In the / code> resource file, I get the following output at runtime

  \ tSearch \ "some string \" (23 hits in 3 files) \ n   < P> It is not clearly treating string literals because C # does itself, I know that I want to move  Shift  +  return  to create a new line in the resource file. To use, but t What do you do for B & E? Please do not copy or paste tabs in Word or Notepad ++, then copy or I can press myself  

What is the best way to convert the string literal contained in the resource file into a real string dictionary that is interpreted properly by C #?

Note that this type of conversion is only going to happen with messages, so I'm ready to consider a runtime conversion too.

Thank you for your time.

I am afraid that you are cooking yourself in the eye, because it is Of course what do you have to do

  String.Format ("{0} search")   

"{1} \" ({2} hits in {3} files) \ N "," \ t ", strSearchString, nTotalHits, nNumberOfFiles);

You can also type alt-012 on numeric keypad to enter a tab.

Finally, by doing a string, you can "avoid" string by passing the string to string.Format () and inserting "\ t" into string processing Change ("\\ t", "\ t") .

All this is a little unsatisfactory! (And I'm sure you already have these Also thought about ideas ...)

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -