Last post Aug 17, 2010 10:10 AM by ankur.nigam
Aug 15, 2010 02:20 PM|puncsos|LINK
I have 163 .resx files. I want to count the words in these files, because my want to translate the sentences (my task is the localisation).
Now I'm opening each file in Ms Visual Studio and I count words manually. How can I count words in all files? And the second question: can I use a program what grab strings from .resx into an editor where I can translate them and save bacn into .resx files?
Or must open the files one by one and edit the text fields manually?
Thanks for helping, unfortunately I'm not a programmer.
Aug 17, 2010 06:41 AM|puncsos|LINK
Nobody can't help me?
Aug 17, 2010 06:48 AM|kdevendra|LINK
you can count no. of words by simply copying all the text from .resx file to a word file, and then using 'word count' utility in the MS word.
Aug 17, 2010 07:20 AM|puncsos|LINK
but unfortunately I have 163 file and 2-20 strings in each file. It's a big work I just want to know if an easier way is available.
Aug 17, 2010 10:10 AM|ankur.nigam|LINK
Below is given the code using which you can read all the content of a particular file and find the character count. You can later expand this snippet to find the total number of characters in all files inside a particular folder (in your scenario, which
may be App_GlobalResources).
' Create an instance of FileStream to read from a file.
Dim fs As New FileStream("c:\TestFile.txt", FileMode.Open, FileAccess.Read)
' Create an instance of StramReader to read the file's content
Dim sr As StreamReader = New StreamReader(fs)
Dim text As String
'Setting pointer at beginning of file
text = sr.ReadToEnd()
Dim FileLength As Long = text.Length 'Holds the total number of characters, number and symbols in file
Console.Write(text.Length) 'Writes the length of file content on Console
sr.Close() 'Closing StreamReader
fs.Close() 'Closing FileStream
Catch E As Exception
' Let the user know what went wrong.
Console.WriteLine("The file could not be read:")
If you need further help, let me know.