the whole file is like this it is a header file btw
char strSaveLoadReadyLoad[] = "@a004@s016@i@cffd8af Loading the above save data.";
#endif
#ifndef _ENGLISH // 日本語
char strSaveLoadLoading[] = "@a004@s016@i@cffd8afもう一度、このセーブデータを選択すると、すぐに Load されます。";
#else // 英語
char strSaveLoadLoading[] = "@a004@s016@i@cffd8af If you select it once more, the data will be loaded.";
#endif
#ifndef _ENGLISH // 日本語
char strSaveLoadHelpInfoChange[] = "ファイル情報の表記を変更します。簡易タイトル、日時が交互に表示されます。";
#else // 英語
char strSaveLoadHelpInfoChange[] = "Fight information display refreshed. Title and date will be displayed.";
#endif
#ifndef _ENGLISH // 日本語
char strSaveLoadHelpCall[] = "利用法についての詳細説明を見る事が出来ます。";
#else // 英語
char strSaveLoadHelpCall[] = "You can view instructions on how to use this.";
#endif
#ifndef _ENGLISH // 日本語
char strSaveLoadHelpCancel[] = "Load ファイルを選択している状態でも Cancel を選ぶと Load されずにゲームに戻ります。"
"@nSave 時は OK でも Cancel でも同じ効果です。";
#else // 英語
char strSaveLoadHelpCancel[] = "Click cancel while selecting a file to load to return to your current game.";
#endif
#ifndef _ENGLISH // 日本語
char strSaveLoadHelpOk[] = "Load 時にファイルを選択して OK を選ぶと、データが Load されゲームが続きから始まります。"
"@nSave 時は、OK でも Cancel でも同じ効果です。";
#else // 英語
char strSaveLoadHelpOk[] = "Click OK while selecting a file to load, and the saved game will be loaded. ";
#endif
#ifndef _ENGLISH // 日本語
char strSaveLoadHelpSaveTitle[] = "ゲーム中にしか使えません。";
#else // 英語
char strSaveLoadHelpSaveTitle[] = "Only available during game play.";
#endif
>>6
The OP wasn't asking for an OS specific solution you retard. In other words, >>5 got the answer (pretty much) right. Now shut your mouth you dumbass jew and leave the programming to the men.
what sucks about this solution is that you don't have translations side by side to compare
Name:
3-san2012-01-01 14:19
>>9
Yep, but in a more practical implementation, you'd keep each language's strings in a different file, and than the problem is trivial (line numbers / comments / some smart format)
Name:
Anonymous2012-01-01 14:20
>>9
But that is a little bit better than the retard that suggested using gettext. Seriously. >>6 should have read the previous responses, and then, like tried to give more than 3 seconds worth of though before opening its mouth.
>>20
And this coming from retard with chronicle NIH-syndrome who wants to reinvent square wheels because he is too stupid to write normal programs, so instead he would prefer to waste his time to solve problems, solved 20 years ago.
Name:
Anonymous2012-01-01 14:55
>>22
You're talking out of your ass. Why don't you actually try and read a book for once in your life you fucking idiot. Oh wait, you can't, because you're just some dumb hourly worker that prefers to not do shit on their day off.
Name:
Anonymous2012-01-01 15:06
Here's how it should be done:
char* strSaveLoadNoneTitle = getstring("@a004@s016@i@cffd8af If you select it once more, the data will be loaded.");
getstring implementation and infrastructure left as an exercise for the reader.
>>22
Well, if you had any clue about real world programming, you would have known that code re-usage is good and versions offered by >>3,5 (adding new languages? I better recompile the whole project). But well, since you never written anything harder than print 2+2 you can't know this.
>>25
Uhh...I actually work as a Senior SOftware Engineer at Kodak you stupid shit. Again, you have zero clue as to what you're talking about. Now why don't you tell us what you do for a living. And plese cite your code contributions to any kind of major piece of software.
>>25 (adding new languages? I better recompile the whole project).
That is by far the dumbest thing you've said so far. Half the time you don't need to recompile the whole project when you add a new language. The fact that you think you do leads to believe that you've never actually worked out in industry.
>>27 >>30
Please stop talking out your [b][i][o][u][sup]A][/sub]SS[/u][/o][/i][/b] about how you're some kind of godly programmer that knows how to do everything [b][i][o][u]R[sup]I[/sub]GHT[/u][/o][/i][/b] when you clearly don't. Let alone how you brag about working for all these good companies in all threads yet you make yourself out to be a total dipshit who probably hasn't let their mothers basement for the past 20 years.
Please go back to /g/ you shitty tripfag, no one likes you faggot.
Name:
Anonymous2012-01-01 15:28
>>34
You still haven't told us what you do for a living. You're obviously ashamed of the fact that you don't work as a computer programmer for a living. Now go run along and write some more toy programs you mental midget.
Name:
Anonymous2012-01-01 15:29
>>35
I don't know everything. I never claimed I did. However, what I do know, I know well. Now shut it.
Name:
Anonymous2012-01-01 15:29
[b][i][o][u][sup]A][/sub]SS[/u][/o][/i][/b]
Name:
Anonymous2012-01-01 15:29
A]SS
Name:
Anonymous2012-01-01 15:30
>>27 Senior SOftware Engineer at Kodak http://www.linkedin.com/in/stevedeal
Steve Deal? Is that you? I will be calling your boss right now to have him reexamine his fellow Senior Software Engineer for sanity checks. You make your company look like shit.
Name:
Anonymous2012-01-01 15:31
It's like the special olympics, only s/physical/mental/
>>40 Systems Analyst, Architect, Engineer, Developer and Integrator. Principal strengths in systems engineering and integration as well as software engineering and development.
I enjoy designing, developing, and implementing cost effective reliable solutions that require the integration of systems and software. It's a blast!
That doesn't sound like him, if it really was him it would've said something like:
Systems Analyst, Architect, Engineer, Developer and Integrator. Why are you reading this you mental midget, could you only get a job with hiring others, fit for someone like you, now go scrub another toilet.
Name:
Anonymous2012-01-01 15:43
>>40
Now that I think about it he's probably hired by Nikon or Canon to tarnish the reputation of Kodak.
>>21
Great, now tell me what character encoding you're getting and how you're going to interface with your output system.
Name:
Anonymous2012-01-01 19:22
[code]enum StringList {
SaveLoadReadyLoad,
SaveLoadLoading,
SaveLoadNoneTitle
/* ... */
}
I would make an enum like this, and use these as indices into the string table.
#define stringize(...) _stringize(__VA_ARGS__)
#define _stringize(...) #__VA_ARGS__
#define concat(x,...) _concat(x,__VA_ARGS__)
#define _concat(x,...) x##__VA_ARGS__
#define LanguageHeader(x) stringize(concat(lang_,x).h)
#include LanguageHeader(LANGUAGE)
If you only want a string table for a single language in the executable, you can always use the preprocessor.
And then in a separate file, do: /* lang_English.h */
const char *StringTable[] = {
"@a004@s016@i@cffd8af Loading the above save data.",
"@a004@s016@i@cffd8af If you select it once more, the data will be loaded.",
"@s024@cffdf3f- No Title."
/* ... */
};
Name:
Anonymous2012-01-01 19:32
char *name[] and not char **name
IHBT
Name:
Anonymous2012-01-01 22:57
programming stumps me, I mean what the hell does an _ in front of a variable this is not in any of the tutorials i've found and let alone how to get information from the OS and finding information about all library or namespace functions...
what the hell is this suppose to mean?
'char strSaveLoadReadyLoad[] = "@a004@s016@i@cffd8af Loading the above save data.";
>>51
yeah, and what if the person using the product wants to change languages? Could be better to store all these strings in a file and load the file at start up. Or include every string of every language hardcoded into the binary.
You need a directory (in the example, it is just a directory called "translations"). Then you need a file for each language you want to translate into. If you had English and German, for example, you would have the files translations/english and translations/german. Every line in English has to be on the same line-number as its translation in German.
Example output:
[blockquote]$ ./lc.exe
Thank you Based Language Converter (English) = Vielen Dank Based Sprache Conver
er (German)[/blockquote]
Name:
Anonymous2012-01-02 0:26
>>53
Bear in mind I literally spent 30 minutes on this thing, so it's probably not robust.
I'm not sure whether it's better to have the user choose the source and destination languages just-in-time (when calling the Convert method) or ahead-of-time (when constructing the object). The former makes each Convert() call longer and more complex, while the latter requires having multiple objects. I went for the former in the end because I thought it was better, but IDK. Maybe if I was going to maintain that code I'd make it possible to do either.
Name:
Anonymous2012-01-02 1:14
Sorry, but you can't store Japanese characters in a char. You'll need a wchar.... and I'm pretty sure .c and .cpp files have to be ascii, so you'll need to find out the hex values of all those Japanese characters.
Name:
Anonymous2012-01-02 1:29
>>55
tell that to the game that works properly that i ripped it from
Name:
Anonymous2012-01-02 1:49
>>55
Or you could use 8-bit non-ASCII strings at runtime. Instead of figuring out what the hex values need to be, you can just use the corresponding ASCII value. I know of a few games that do this... and probably every 8-bit console game in Japanese does it.
>>53 >>54
>not caching at all, not even naive caching
Enjoy your O(n) disk thrashing just to find the same string 1000 times.
Name:
Anonymous2012-01-02 16:49
>>55 and I'm pretty sure .c and .cpp files have to be ascii
Actually the encoding is unspecified. EBCDIC and Shift-JIS are perfectly acceptable character sets for C and C++ source code, that's why there are trigraphs and digraphs.
Name:
Anonymous2012-01-03 0:22
>>59
You're shit. C++ is a better progaming language than you'll ever be
>>61
I spent less than an hour on it. Also I like how you notice the lack of caching but not the fact that it breaks if there's a newline in srcString.
I'll add caching to the list of improvements to be made
Name:
Anonymous2012-01-03 7:04
>>63
To be honest I don't think any person is a good "progaming" language, or even programming language for that matter.
Granted, C++ is a really shitty language, it might so bad that it's actually worse than not having any programming language at all, in which case even people can be better programming languages than C++.
Name:
Anonymous2012-01-03 10:52
>>64 Jews make good programming languages, and even better pro-gaming languages.