473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Culture-specific file size units ("KB" vs. "Koctets") ?

(If this is not posted in the right place, please let me know what the right
place is...)
I understand that French Windows Explorer uses "Ko" as the file size units
where English would use "KB". My C# application is going to display file
sizes and I would like it to use the correct string based on the user's
locale. Is there any way to get the correct string "Ko/KB/whatever" from
..NET or Windows?

-Russ
Nov 22 '05 #1
8 6294
Russ,

Just an idea, why not ask this in a French newsgroup, they will answer you
probably directly even if you do it in English and excuse yourself for that.

Octet is of course a byte (8bits)

Cor
Nov 22 '05 #2
Not sure to understand the exact problem. Did you see what .NET offers for
application localization ? I would include these strings as resources in my
own application.The resource will be selected based on the language.

Do you have only this string to localize ?

Patrice

--

"RussC" <Ru***@discussions.microsoft.com> a écrit dans le message de
news:B1**********************************@microsof t.com...
(If this is not posted in the right place, please let me know what the right place is...)
I understand that French Windows Explorer uses "Ko" as the file size units
where English would use "KB". My C# application is going to display file
sizes and I would like it to use the correct string based on the user's
locale. Is there any way to get the correct string "Ko/KB/whatever" from
.NET or Windows?

-Russ

Nov 22 '05 #3
The application has lots of other strings to localize and we are already
using string resources which .NET retrieves based on culture. Certainly I
can include these strings in that way. I just thought it would be even
better if there was a way to somehow retrieve a string for file size units
from the environment somehow. After some looking I could not find such a way
-- but I thought I would ask the group if there was indeed a way to do that.
Maybe there isn't.

"Patrice" wrote:
Not sure to understand the exact problem. Did you see what .NET offers for
application localization ? I would include these strings as resources in my
own application.The resource will be selected based on the language.

Do you have only this string to localize ?

Patrice

--

"RussC" <Ru***@discussions.microsoft.com> a écrit dans le message de
news:B1**********************************@microsof t.com...
(If this is not posted in the right place, please let me know what the

right
place is...)
I understand that French Windows Explorer uses "Ko" as the file size units
where English would use "KB". My C# application is going to display file
sizes and I would like it to use the correct string based on the user's
locale. Is there any way to get the correct string "Ko/KB/whatever" from
.NET or Windows?

-Russ


Nov 22 '05 #4
What are the names of some French newsgroups that might be relevant?

Thanks,
Russ

"Cor Ligthert" wrote:
Russ,

Just an idea, why not ask this in a French newsgroup, they will answer you
probably directly even if you do it in English and excuse yourself for that.

Octet is of course a byte (8bits)

Cor

Nov 22 '05 #5
Russ,

I think that is not important, however you can take the program language you
use
something as

microsoft.public.fr.dotnet.csharp
or just
microsoft.public.fr.dotnet

Cor
What are the names of some French newsgroups that might be relevant?

Nov 22 '05 #6
Russ,
I don't know of a function to retrieve the information from Windows.

However you could set up a "string table" resource that you then localize.
Every place you need the string, you would retrieve the string wanted from
the resource.

Here are some MSDN articles that should get you started:

http://msdn.microsoft.com/library/de...nalization.asp

http://msdn.microsoft.com/library/de...gresources.asp

The directory structure itself is shown at the bottom of:

http://msdn.microsoft.com/library/de...assemblies.asp

When you use VS.NET to create your international resources VS.NET create the
folder structure needed in the bin (output) folder.

I normally use .resx files with VS.NET...

Hope this helps
Jay
"RussC" <Ru***@discussions.microsoft.com> wrote in message
news:B1**********************************@microsof t.com...
(If this is not posted in the right place, please let me know what the
right
place is...)
I understand that French Windows Explorer uses "Ko" as the file size units
where English would use "KB". My C# application is going to display file
sizes and I would like it to use the correct string based on the user's
locale. Is there any way to get the correct string "Ko/KB/whatever" from
.NET or Windows?

-Russ

Nov 22 '05 #7
I understand that French Windows Explorer uses "Ko" as the file size units
where English would use "KB". My C# application is going to display file
sizes and I would like it to use the correct string based on the user's
locale. Is there any way to get the correct string "Ko/KB/whatever" from
.NET or Windows?


There are a few Win32 APIs for formatting file sizes;
StrFormatByteSize* for returning the size scaled to the "best" 1024
multiple, or StrFormatKBSize if you always want the unit to be KB.

http://msdn.microsoft.com/library/en...bytesize64.asp
http://msdn.microsoft.com/library/en...rmatkbsize.asp

If you prefer to roll your own algorithm and just need the string,
these are available as string resources 259 - 265 in Shlwapi.dll. I
assume these are localized appropriately, but I don't have a french
system to verify it on.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 22 '05 #8
My personal preference would be still to keep this string in my own
resources :
- simplicity, I don't feel really clean to use resources for all except this
one (plus it could change, break or whetever)
- you could have an inconsistent UI ie. having the size units localized but
all else using the default language (if you have no translations for this
particular language).

Patrice
--

"Mattias Sjögren" <ma********************@mvps.org> a écrit dans le message
de news:O4**************@TK2MSFTNGP11.phx.gbl...
I understand that French Windows Explorer uses "Ko" as the file size unitswhere English would use "KB". My C# application is going to display file
sizes and I would like it to use the correct string based on the user's
locale. Is there any way to get the correct string "Ko/KB/whatever" from
.NET or Windows?
There are a few Win32 APIs for formatting file sizes;
StrFormatByteSize* for returning the size scaled to the "best" 1024
multiple, or StrFormatKBSize if you always want the unit to be KB.

http://msdn.microsoft.com/library/en...bytesize64.asp http://msdn.microsoft.com/library/en...rmatkbsize.asp
If you prefer to roll your own algorithm and just need the string,
these are available as string resources 259 - 265 in Shlwapi.dll. I
assume these are localized appropriately, but I don't have a french
system to verify it on.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tomas Vera | last post by:
Hello All, In an effort to prepare my WebApp for localization, I have included the following lines in some of my ASPX pages (the "lab mice" of my web app). --- Code snippet -----...
0
by: Ashish | last post by:
we recently introduced session state management with state server in our application, but its seems to be having some thread culture problems ... the issue is that the culture of the thread in...
3
by: Ian O'Rourke | last post by:
Okay, I have a problem with the en-GB culture object My computer is set to the UK and for UK date formats, etc If I set my culture to en-GB in the web.config everything works fine with UK dates...
3
by: Shapper | last post by:
Hello, I am working on a multi-language web site. After a lot of searching and reading I was able to define a way to do this. However, I need some help to put this on. I am working on...
9
by: Edge | last post by:
hi, I am saving the user selected culture in a session variable so I can apply it back to all pages when refreshed and then load the proper .resx values. For that I am using global.asax
6
by: Mike9900 | last post by:
Hello, I want to view the calendar in another culture, for example let it show in Arabic. I use this code in the Main, but the calendar is still in the same culture: CultureInfo sa = new...
2
by: Lucky | last post by:
hi guys! i've got one interesting problem. one of my utility is generating data machine specific, i mean the data is generated in the culture that the machine has. my problem is with the...
6
by: Tony | last post by:
Hello! My first question: I just can't figure out what is the usefulness of Comparer.Default.Compare(somestring1, somestring2); because I can just the same use...
0
by: shapper | last post by:
Hello, I need to define the culture of my web site based on a profile property. So I created a new class: public class Config : Page { protected override void InitializeCulture() {...
1
by: shapper | last post by:
Hello, I am initializing the culture of a page as follows: protected override void InitializeCulture() { base.InitializeCulture(); CultureInfo culture = Profile.Get().Visitor.Culture; if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.