Search found 78 matches

by Virchanza
Sun Feb 09, 2020 8:09 pm
Forum: C++ Development
Topic: How to change language at runtime
Replies: 8
Views: 662

How to change language at runtime

My application can change language at runtime. You can use the interface in English, then you can click the English flag and select German, and continue to use the interface in German. You can switch back and forth between languages at runtime like that. The way my application is currently coded, th...
by Virchanza
Sun Feb 09, 2020 4:52 pm
Forum: C++ Development
Topic: Multilingual application (without locales or internationalisation)
Replies: 30
Views: 1557

Re: Multilingual application (without locales or internationalisation)

ONEEYEMAN wrote:
Fri Feb 07, 2020 8:55 pm
So basically you want to save a couple of micro-seconds on loading the files from disk.
I don't know what you meant by this.
by Virchanza
Sat Feb 08, 2020 8:47 pm
Forum: C++ Development
Topic: Read from input iterator (wxResourceTranslationsLoader)
Replies: 8
Views: 512

Re: Read from input iterator (wxResourceTranslationsLoader)

The conversion from in-memory data to wxMsgCatalog looks a little complicated. The member function "CreateFromData" takes a wxScopedCharBuffer. Later when I'm sitting at a PC, I'll take a closer look at this: https://docs.wxwidgets.org/3.0/classwx_scoped_char_type_buffer.html It looks like I'll be ...
by Virchanza
Sat Feb 08, 2020 6:15 pm
Forum: C++ Development
Topic: Read from input iterator (wxResourceTranslationsLoader)
Replies: 8
Views: 512

Re: Read from input iterator (wxResourceTranslationsLoader)

I'm also working on a Makefile that will automatically process all your ".mo" files into char arrays before your application is compiled. So if you ever change a translation catalogue, you just need to hit "make" and it will automatically re-process all your ".mo" files into char arrays before your ...
by Virchanza
Sat Feb 08, 2020 6:11 pm
Forum: C++ Development
Topic: Read from input iterator (wxResourceTranslationsLoader)
Replies: 8
Views: 512

Re: Read from input iterator (wxResourceTranslationsLoader)

Note that you can get this to read from any kind of input stream by using "std::istream_iterator". Here's how you'd get it to read from standard input: wxTranslationsLoader *const p = new wxInputIteratorTranslationsLoader< std::istream_iterator<char unsigned> >; p->MakeCatalogueVisible( wxT("de"), i...
by Virchanza
Sat Feb 08, 2020 5:47 pm
Forum: C++ Development
Topic: Read from input iterator (wxResourceTranslationsLoader)
Replies: 8
Views: 512

Re: Read from input iterator (wxResourceTranslationsLoader)

I did this on my smartphone in a coffee shop so don't go too hard on me. I haven't tried to compile it. Here is the beginnings of wxInputIteratorTranslationsLoader: #include <vector> #include <tuple> #include <iterator> template<typename InputIterator> class wxInputIteratorTranslationsLoader : publi...
by Virchanza
Sat Feb 08, 2020 4:48 pm
Forum: C++ Development
Topic: Read from input iterator (wxResourceTranslationsLoader)
Replies: 8
Views: 512

Re: Read from input iterator (wxResourceTranslationsLoader)

Here's the code from wxResourceTranslationsLoader that I will be adapting: wxMsgCatalog *wxResourceTranslationsLoader::LoadCatalog(const wxString& domain, const wxString& lang) { const void *mo_data = NULL; size_t mo_size = 0; const wxString resname = wxString::Format("%s_%s", domain, lang); if ( !w...
by Virchanza
Sat Feb 08, 2020 3:01 pm
Forum: C++ Development
Topic: Read from input iterator (wxResourceTranslationsLoader)
Replies: 8
Views: 512

Read from input iterator (wxResourceTranslationsLoader)

I want to be able to embed my translation catalog (.mo) files in my binary executable by having the .mo files as global byte arrays like this: char unsigned const g_catalog_german[] = {0x01,0x02,0x03,0x04}; The command line program "xxd" can be used to easily turn a binary file into a sequence of he...
by Virchanza
Fri Feb 07, 2020 9:05 pm
Forum: C++ Development
Topic: Multilingual application (without locales or internationalisation)
Replies: 30
Views: 1557

Re: Multilingual application (without locales or internationalisation)

ONEEYEMAN wrote:
Fri Feb 07, 2020 8:55 pm
Hi,
So basically you want to save a couple of micro-seconds on loading the files from disk.
Good luck on that.

Personally I don't think it is worth it, but YMMV.

Thank you.
I will distribute my application as one executable file that does not need to be installed
by Virchanza
Fri Feb 07, 2020 7:41 pm
Forum: C++ Development
Topic: Multilingual application (without locales or internationalisation)
Replies: 30
Views: 1557

Re: Multilingual application (without locales or internationalisation)

The language discussion aside... I still do not get why you wish to abandon the true and tried way of storing translations catalogues, i.e., in the expected folder with folders for individual languages (btw, the domain is not a language ). It works as expected out of the box and can be used without...
by Virchanza
Fri Feb 07, 2020 6:18 pm
Forum: C++ Development
Topic: Multilingual application (without locales or internationalisation)
Replies: 30
Views: 1557

Re: Multilingual application (without locales or internationalisation)

ONEEYEMAN wrote:
Fri Feb 07, 2020 4:55 pm
Well, that's goiong to be one very weird application. At least for me..
Do you speak Mexican Spanish?
by Virchanza
Fri Feb 07, 2020 4:43 pm
Forum: C++ Development
Topic: Multilingual application (without locales or internationalisation)
Replies: 30
Views: 1557

Re: Multilingual application (without locales or internationalisation)

Hi, And Mexican with Spanis? Did you consider the language differences? One word can have a different meaning in different dialects... Thank you. There is no limit to how far you can go with that. People who live on one street in a housing estate might use different words to people who live across ...
by Virchanza
Fri Feb 07, 2020 3:59 pm
Forum: C++ Development
Topic: Multilingual application (without locales or internationalisation)
Replies: 30
Views: 1557

Re: Multilingual application (without locales or internationalisation)

Just remember that "de_DE" will contain German German translations and "de_SWITZERLAND" (sorry don't know the country code on top of my head) will contain German Swiss translations. How will you program will differentiate between them? The German-speaking Swiss will make do with "de". There won't b...
by Virchanza
Fri Feb 07, 2020 3:57 pm
Forum: C++ Development
Topic: Multilingual application (without locales or internationalisation)
Replies: 30
Views: 1557

Re: Multilingual application (without locales or internationalisation)

And finally - the number presentation. How do you read the number "123.560"? I would "One hundred twenty three and fifty six hundredth". But in some other country it can be read as "One hundred thousands twenty three Five hundred sixty". Guess what - you program will produce faulty results, brcause...
by Virchanza
Fri Feb 07, 2020 3:36 pm
Forum: C++ Development
Topic: Multilingual application (without locales or internationalisation)
Replies: 30
Views: 1557

Re: Multilingual application (without locales or internationalisation)

PB wrote:
Fri Feb 07, 2020 3:33 pm
Just curious, what problems could using a correct locale create? I cannot think of any...
I was getting message box errors on Ubuntu saying it failed to load the "de" or "ga" locale. That's enough grief for me to cut it out if I don't need it.