|
Why do you need all the strings loaded at compile time?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You cannot "#include" files at runtime.
Me think you need to review your language pack approach.
either generate resource only DLL, one for every language that will each share the same ID that will be referenced in the code; and have the DLL loaded when the application starts (or on demand)
or
have one language header file that contains all languages in a table, one line per word to be translated; and strings ID that will be references in the code; different than STRING resource id.
ID french english german ...
-------------------
123 "allo" "hello" "hallo"
...
...
YMMV.
Max
This signature was proudly tested on animals.
|
|
|
|
|
[quote]
either generate resource only DLL, one for every language that will each share the same ID that will be referenced in the code; and have the DLL loaded when the application starts (or on demand)
[/quote]
+1 to this argument. I think this is the best option.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Not sure about the overall design of your app, but I suppose you have english in place and you are going for I18N
Few options:
1) generate one resource dll per language, disadvantages, you will end up in 10 different files in your directory which you are already doing.
2) generate no dll (copy all the strings into the English id and then on you can make copies for each language. the advantage of the approach is you will have same ids, for all the languages. and you can make a wrapper function to load a string like
LoadMyString(langId,ID_OF_STRING_FROM_STRINGTABLE) and setting langID based on user selection or certain criteria for whole UI session.
disadv: you need all string information at compile time.
Regards
Abhi
|
|
|
|
|
First of all... I am not the one that started the thread, so your answer should be to the Top_Question_post, not to my oppinion. But.. anyways.
As answer to you...
1) Yes, you will have different files in your directory, but... take a look into your C:\Program Files\... and tell me how many of you installed software has less than 10 files in the folder.
If you don't like the DLLs, ok, I can understand it.
But you can use INI-Files as well, with the advantage that INI-Files can be easier to work with (just a Notepad may be enough if you don't want it more difficult to be modified), you can send them to a Translator or whatever and then just copy the "LangXXX.ini" in the application folder and it is done, just count on the possibility that the file may not be there when you call your "Change_Lang ()" and give an error message if that's the case.
2) Another disadvantage... for each and every single correction in the translations of you strings, you will need a new compile of the whole program, that means endless new versions of software just for "language issues" instead of software-bugs or additional features.
I guess the main point is just what one likes or not. And that's the nice thing on diversity, each person can choose whatever he/she likes better. I personally prefer independant files.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi to All,
I have some problem in Logic, while reading a file (which has many objects of structure A,)...and buffering it to a dynamically allocated memory...
What I am doing exactly is that....I need to read the file...and if there is any data available, then put it to a new structure (dynamical allocated memory)...
Problem is ..<b>where do I declare/allocate memory for the structure</b>, I cannot declare in beginning of the loop, because fread() will overwrite into the same memory location...
something like....
A *lpA = new A;
while(fread(lpA,sizeof(lpA),1,ptr_myfile) != EOF)
{
...do something(Add the pointer into a List)
}
Similar problem with declaring it inside the loop... fread() needs the first parameter...
-----------------------------
I am a beginner
|
|
|
|
|
If you're using C++ , an option maybe usign STL constainers, for instance a vector :
std::vector <A> v;
A a;
while (fread(&a, sizeof(a), 1, ptr_myfile) != EOF)
{
v.push_back(a);
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi Friends
CImage img;
img.Load (" 1.jpg ");
img.save ("2.tif",Gdiplus::ImageFormatTIF);
its converting the image jpg to tif. but i need to convert with out comparession mode ..how to do it ??
thanks
Raju
Failure is Success If we learn from it!!
|
|
|
|
|
You've to use directly GDI+ Image (CImage is just a wrapper of) class for that purpose , I suppose.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Use BMP, unless set for RLE, it uses no compression whatsoever.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi To All,
I have written a code to write some data to a binary file system ...(I am writing 3 structure with different size)...one after another. like A,B,C
I dont have any delimiter or special object to know the next size(bytes) to read from the file .
Because of that I always read one by one....
Now I want to overwrite the middle structure...(B).....While over writing I am having some problem...
what I did is...
...Read the file with size of A (in order to point the file pointer to the next memory..ie starting of struct B)...then write the second structure with the sizeof(B)...
I have open the file in r+b mode....
Now when I read the file its showing some error
please help me for the same...
-----------------------------
I am a beginner
|
|
|
|
|
What about:
- Read the whole file into the three variables.
- Modify the intended variable(s).
- Write again all the three variables to the file.
?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I guess thats the easiest method, it dint strike my head...Hehe
Thanks anyway,
But for my knowledge I wanted to know, if we can do the other way....
-----------------------------
I am a beginner
|
|
|
|
|
Yes, of course, you may do it the other way: post your code if you need help about.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Theoretically, it is the right thing you've done concerning the write part. However, when reading your file again you encounter an error.
We need source code here.
Easy Profiler : Now open source !
http://www.codeproject.com/KB/cpp/easyprofiler.aspx
|
|
|
|
|
sorry...its not error,...but its some junk values...
-----------------------------
I am a beginner
|
|
|
|
|
Yes I know.
What I meant by "encountering an error" is the fact that you get unexpected values when you re-read your file, while, theroetically, you should get the same as updated by the write operation.
Easy Profiler : Now open source !
http://www.codeproject.com/KB/cpp/easyprofiler.aspx
|
|
|
|
|
I advise you not to surrender. You could be doing some mistake in manipulating the IO routines that you would commit again have you decided to embark into a new method.
Easy Profiler : Now open source !
http://www.codeproject.com/KB/cpp/easyprofiler.aspx
|
|
|
|
|
i guess the new method would be very simple..i think i will adopt that.
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: Now when I read the file its showing some error
We cannot guess what this is; if you get an error then put the details here so someone can help you.
|
|
|
|
|
oh sorry for the miss interpreting...its not error,...but its some junk values...
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: ...Read the file with size of A (in order to point the file pointer to the next memory..ie starting of struct B).
-just an...hmm, how to say..."architectural" note here, you can use seeking (fseek[^], CFile::Seek[^], don't know how you work with your file) to position the file pointer, so if you know that your file contains A B and C in this order and you know their sizes you can position the file pointer at the beginning of B by seeking from the beginning of the file to sizeof(A) position, this way you don't need to read the A struct and can save up on speed and memory, i know this doesn't really make much of a difference when your structs are small.
After wirting to the file, did you close it and reopen it and then read A and B (and maybe C) to check the result of your previous write? If you are doing the writing and then reading of your B structure "in the same session", without closign the file, did you seek back to the start of the B structure before reading?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I am having a jpeg image & ia want to make it as a icon for my dialog based application.My application has multiple diloag.when i tried to copy my image & paste in the icon i am nt gettng the proper image.
|
|
|
|
|
It seems your icon editor is not supporting all the colors in your jpeg image. May be you can use an image dititor like Photoshop or GIMP (it is free)to create your icons from the jpeg image.
|
|
|
|
|
Additionally to what Rejeesh said, i recommend IcoFX[^], it's free and it is quite good and easy to use.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|