473,405 Members | 2,185 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,405 software developers and data experts.

localization issue

hi,
i've some C and C++ code written. I'll speak about the C code here.
All of the text user interface is with printfs and scanf. They are
all ascii characters. They are working well on english . Now i have to
change these
printf("Select 1 for choosing option billing \n") ; to japanese ,
chinese etc.

One option would be to use GNU gettext but there are issue with GPL
code.

My idea is to store for each language a prefix code and the string in
seperate file

like for japanese , str_ja
1 "japanse string for choosing optino billing"
2 " japenase optin for chooseing the payment mode"

str_cn similar.
Will replacing the char str[1000] with wchar str[1000] and printf with
wprintf and reading string with wscanf work or is there something
else along with wscanf , wprintf to be done ? .

I fail to understand the relevance of wcstombs_s, _wcstombs_s_l . Why
are these even required ? i have everything in wscanf and wprintf.

What do you guys use or recommend in such situations or how to design
such tasks ?
Nov 18 '08 #1
3 2611
On 18 Nov 2008 at 23:08, Terry IT wrote:
One option would be to use GNU gettext but there are issue with GPL code.
I think you'll find the gettext *library* is under the LGPL.

Nov 18 '08 #2
On Nov 19, 4:21*am, Antoninus Twink <nos...@nospam.invalidwrote:
On 18 Nov 2008 at 23:08, Terry IT wrote:
One option would be to use GNU gettext but there are issue with GPL code.

I think you'll find the gettext *library* is under the LGPL.
thanks but i have restrictions on gettext and catgets . Since the
strings are around 1000 , i've to do it with plain data types. Library
would have been so easy.
Nov 19 '08 #3
Terry IT wrote:
hi,
i've some C and C++ code written. I'll speak about the C code here.
All of the text user interface is with printfs and scanf. They are
all ascii characters. They are working well on english . Now i have to
change these
printf("Select 1 for choosing option billing \n") ; to japanese ,
chinese etc.

One option would be to use GNU gettext but there are issue with GPL
code.

My idea is to store for each language a prefix code and the string in
seperate file

like for japanese , str_ja
1 "japanse string for choosing optino billing"
2 " japenase optin for chooseing the payment mode"

str_cn similar.
Will replacing the char str[1000] with wchar str[1000] and printf with
wprintf and reading string with wscanf work or is there something
else along with wscanf , wprintf to be done ? .
Keep in mind that it is perfectly legal for an implementation to
provide no support for any locales other than "C" and "". wchar_t and
char can both be 8-bit types with the same character encoding, one
that doesn't accommodate (for instance) Japanese characters.

On implementations with support for a Japanese locale, you'll need to
call setlocale(), and the name of the locale you'll need to pass to
setlocale() depends upon your implementation.

If you use wprintf() to write text and wscanf() to read it, using the
same implementation of C, they should work together properly. However,
keep in mind that the character encoding used by those functions is
implementation-defined. You can't guarantee that files created by
wprintf() calls in a program created using one implementation of C
can be read correctly using wscanf() calls by a program created with
a different implementation of C. You'll need to study the two
implementations' documentation to verify whether they can be
configured to use compatible encodings. In principle, this is also
true for printf() and scanf(), but the opportunities for a mis-match
are much greater with wchar_t.
I fail to understand the relevance of wcstombs_s, _wcstombs_s_l . Why
Those are so-called "secure" versions of wctombs() that have been
proposed by Microsoft as additions to a future version of the C
standard. It's debatable whether they actually enable significant
improvements in security.

You won't need wcstombs() if you keep everything in wchar_t. However,
keep in mind that a few C standard library functions require char*
arguments, and have no equivalent function that takes a wchar_t*
argument. The most notable of these is fopen(). If you're reading in a
file name with wscanf() and passing it to fopen(), you might need to
call wcstombs().
What do you guys use or recommend in such situations or how to design
such tasks ?
I've never coded an application which required the ability to read or
write data in any encoding other than US ASCII, so there's lots of
people better equipped to answer your question than I am. I've only
addressed the issues you've raised that I am familiar with.
Nov 19 '08 #4

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

Similar topics

7
by: iceriver | last post by:
Hi All, I already have a web site running with SQL Server as a backend (in english)For future growth, I would like to make it localized. Regarding the database, I have come up with several...
0
by: Bill | last post by:
Hi Everyone, I am having some difficulty in using the Windows Resource Localization Editor (WinRes.exe) on several Visual Basic .NET forms (.resx files) in two different projects. The editor...
3
by: Eric | last post by:
Hi, I'm just looking into the samples that are delivered withthe Enterprise Localization Framework/Toolkit. I have set it up and it all works fine. But.. now i have a question. I read a...
6
by: Rental | last post by:
I'm having the sam problem as described below with the Localization toolkit. Does anyone know if there is a solution to this problem. --->When attempting to generate resource dlls with...
5
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the...
1
by: Bruno Alexandre | last post by:
Hi Guys, I'm driving crazy here with Localization issue, this is what I have now: masterpage.master - with some asp:linkbutton like this: <asp:LinkButton PostBackUrl="~/login/Default.aspx"...
5
by: CMM | last post by:
I don't seem to "get" ASP.NET 2.0's Localization features. I've read up on everything... and of course, everything is explained in cursory softball terms- not any "real-world" usage way. I hope...
6
by: Srini | last post by:
Hi, I am facing a problem in localizing the setup file and .NET framework redistributable. I am trying to deploy c# winform application. I have created a setup project. I need to...
2
by: =?Utf-8?B?QnJhZCBBc2hmb3J0aA==?= | last post by:
We have the environment mentioned above. The Server OS is Windows Server 2003 SP2 and the client machine is XPPro SP 2. Several years ago we coded the application to "support localization". At that...
1
by: =?Utf-8?B?QnJldHQ=?= | last post by:
I have a basic user control that I want to localize. I created a global resource and connected up the properties I want to localize using an explicit localization expression. Everything works...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.