1

Topic: Simple method static language wanted

Not to invent a bicycle, decided to ask at skilled how easier to organize static (not assuming change of language in the course of program operation) internalization (as a first approximation that at compilation it was possible to select language). For example, if to organize map how to store keys - lines or uid (the first is more evident, the second is is more general-purpose and is more effective). If uid from enum-in (that was more evident), whether that it is possible to get rid of duplication of its mention - at determination uid and at its binding with a line? Well, etc. Thanks.

2

Re: Simple method static language wanted

Hello, _hum _, you wrote: __> not to invent a bicycle, decided to ask at skilled how easier to organize static (not assuming change of language in the course of program operation) internalization (as a first approximation that at compilation it was possible to select language). __> For example if to organize map how to store keys - lines or uid (the first is more evident, the second is is more general-purpose and is more effective). If uid from enum-in (that was more evident), whether that it is possible to get rid of duplication of its mention - at determination uid and at its binding with a line? __> well, etc. __> Thanks. The most simple method - separate.h files with #define MSG_HELLO "hello" / #define MSG_HELLO "Greetings" necessary at compilation is connected

3

Re: Simple method static language wanted

Hello, wl., you wrote: wl.> Hello, _hum _, you wrote: __>> not to invent a bicycle, decided to ask at skilled how easier to organize static (not assuming change of language in the course of program operation) internalization (as a first approximation that at compilation it was possible to select language). __>> For example if to organize map how to store keys - lines or uid (the first is more evident, the second is is more general-purpose and is more effective). If uid from enum-in (that was more evident), whether that it is possible to get rid of duplication of its mention - at determination uid and at its binding with a line? __>> well, etc. __>> Thanks. wl.> the most simple method - separate.h files with #define MSG_HELLO "hello" / #define MSG_HELLO "Greetings" wl.> necessary at compilation it is connected and how a contamination of space and danger of intersection of names of macroes of lines with working program identifiers?

4

Re: Simple method static language wanted

Hello, _hum _, you wrote: __> not to invent a bicycle, decided to ask at skilled how easier to organize static (not assuming change of language in the course of program operation) internalization (as a first approximation that at compilation it was possible to select language). __> For example if to organize map how to store keys - lines or uid (the first is more evident, the second is is more general-purpose and is more effective). If uid from enum-in (that was more evident), whether that it is possible to get rid of duplication of its mention - at determination uid and at its binding with a line? __> well, etc. Resource files: *.rc (STRINGTABLE)

5

Re: Simple method static language wanted

Hello, _hum _, you wrote: __> and how a contamination of space and danger of intersection of names of macroes of lines with working program identifiers? Not mandatory to do , it is possible to do constants  logically to do for hot change of language. For a statics it is better than a constant. If still it is necessary to format the text (well there to substitute any values) it is better to function which will do formatting to select

6

Re: Simple method static language wanted

Hello, uzhas, you wrote: U> Hello, _hum _, you wrote: __>> and how a contamination of space and danger of intersection of names of macroes of lines with working program identifiers? U> not mandatory to do , it is possible to do constants U>  logically to do for hot change of language. For a statics it is better than a constant. If still it is necessary to format the text (well there to substitute any values) it is better to select functions which and to do constant formatting it will be necessary to mention two times - at determination and at

7

Re: Simple method static language wanted

Hello, AlexGin, you wrote: AG> Hello, _hum _, you wrote: __>> not to invent a bicycle, decided to ask at skilled how easier to organize static (not assuming change of language in the course of program operation) internalization (as a first approximation that at compilation it was possible to select language). __>> For example if to organize map how to store keys - lines or uid (the first is more evident, the second is is more general-purpose and is more effective). If uid from enum-in (that was more evident), whether that it is possible to get rid of duplication of its mention - at determination uid and at its binding with a line? __>> well, etc. AG> Resource files: *.rc (STRINGTABLE) it is what in mfc?

8

Re: Simple method static language wanted

Hello, _hum _, you wrote: AG>> Resource files: *.rc (STRINGTABLE) __> it is what in mfc? It and without mfc works. Sm here: https://msdn.microsoft.com/en-us/librar … p/aa381050 (v=vs.85).aspx

9

Re: Simple method static language wanted

Hello, uzhas, you wrote: U> Hello, _hum _, you wrote: AG>>> Resource files: *.rc (STRINGTABLE) __>> it is what in mfc? U> it and without mfc works. Sm here: https://msdn.microsoft.com/en-us/librar … p/aa381050 (v=vs.85).aspx horror-terrifying (it I not about your name, and about that  these resources till now there under crude )

10

Re: Simple method static language wanted

11

Re: Simple method static language wanted

12

Re: Simple method static language wanted

Hello, _hum _, you wrote: __> not to invent a bicycle, decided to ask at skilled how easier to organize static (not assuming change of language in the course of program operation) internalization (as a first approximation that at compilation it was possible to select language). __> For example if to organize map how to store keys - lines or uid (the first is more evident, the second is is more general-purpose and is more effective). If uid from enum-in (that was more evident), whether that it is possible to get rid of duplication of its mention - at determination uid and at its binding with a line? __> well, etc. where is easier?//Msg.h #pragma once struct Msg {typedef const char* Strings; static Strings hello, world;};//Msg_EN.cpp #include "Msg.h" Msg:: Strings Msg:: hello = "hello", Msg:: world = "world";

13

Re: Simple method static language wanted

Hello, _niko_. Thanks, the interesting approach, though also technical enough. But I here, on time proprocession, came to a conclusion what to carry out all the line long in separate tables is not absolutely successful decision as transfer very strongly depends on a context that is why, logically, it is necessary also somehow the information on a context to save. Therefore, made decision to do all immediately in the code, like: //////////////////////////////////////////////////////////////////////CRepresentationExpertsPool////////////////////////////////////////////////////////////////////// class CRepresentationExpertsPool {public://....................................................... enum class ELanguages {ru_lang, eng_lang}; private: static ELanguages s_lang; public: static ELanguages get_lang (void) {return s_lang;} static ELanguages set_lang (const ELanguages lang) {s_lang = lang;}//------------------------- template <typename Res_T> static Res_T switch_trsl (Res_T trsl_str) {return trsl_str;} //------------------------- template <typename Res_T, typename... Pack> static Res_T switch_trsl (const ELanguages lang, Res_T trsl_str, Pack... TailArg) {if (get_lang () == lang) return trsl_str; return switch_trsl (TailArg...);}//-------------------------//<....>}; ////////////////////////////////////////////////////////////////// int main () {typedef CRepresentationExpertsPool RepPool_T; RepPool_T:: set_lang (RepPool_T:: ELanguages:: ru_lang); std:: wstring swButtonText = RepPool_T:: switch_trsl (RepPool_T:: ELanguages:: ru_lang, L "Cancelling", RepPool_T:: ELanguages:: eng_lang, L "Cancel", L "??????");//<...>}

14

Re: Simple method static language wanted

Hello, kov_serg, you wrote: _> Hello, _hum _, you wrote: __>> not to invent a bicycle, decided to ask at skilled how easier to organize static (not assuming change of language in the course of program operation) internalization (as a first approximation that at compilation it was possible to select language). __>> For example if to organize map how to store keys - lines or uid (the first is more evident, the second is is more general-purpose and is more effective). If uid from enum-in (that was more evident), whether that it is possible to get rid of duplication of its mention - at determination uid and at its binding with a line? __>> well, etc. _> where is easier? _> _>//Msg.h _>#pragma once _> struct Msg {_> typedef const char* Strings; _> static Strings _> hello, world; _>}; _>//Msg_EN.cpp _>#include "Msg.h" _> Msg:: Strings _> Msg:: hello = "hello", _> Msg:: world = "world"; _> already spoke - code dubbing-in, and as consequence, necessity to trace synchronization (here jam casually variable initialization world and all - potentially incorrect operation of the interface (and if it is a variable storing an inscription for start of the nuclear missile all can come to an end is sad))

15

Re: Simple method static language wanted

Hello, _hum _, you wrote: __> not to invent a bicycle, decided to ask at skilled how easier to organize static internalization. And standard gettxet does not approach? Like simple as a stick.

16

Re: Simple method static language wanted

Hello, _hum _, you wrote: __> But I here, on time proprocession, came to a conclusion what to carry out all the line long in separate tables is not absolutely successful decision as transfer very strongly depends on a context that is why, logically, it is necessary also somehow the information on a context to save. Therefore, made decision to do all immediately in the code, like: How many at you buttons "Cancellings"? And what do you think of ?

17

Re: Simple method static language wanted

Hello, _hum _, you wrote: __> Hello, kov_serg, you wrote: _>> Hello, _hum _, you wrote: __>>> not to invent a bicycle, decided to ask at skilled how easier to organize static (not assuming change of language in the course of program operation) internalization (as a first approximation that at compilation it was possible to select language). __>>> For example if to organize map how to store keys - lines or uid (the first is more evident, the second is is more general-purpose and is more effective). If uid from enum-in (that was more evident), whether that it is possible to get rid of duplication of its mention - at determination uid and at its binding with a line? __>>> well, etc. _>> where is easier? _>> _>>//Msg.h _>>#pragma once _>> struct Msg {_>> typedef const char* Strings; _>> static Strings _>> hello, world; _>>}; _>>//Msg_EN.cpp _>>#include "Msg.h" _>> Msg:: Strings _>> Msg:: hello = "hello", _>> Msg:: world = "world"; _>> __> already spoke - code dubbing-in, and as consequence, necessity to trace synchronization (here jam casually variable initialization world and all - potentially incorrect operation of the interface (and if it is a variable storing an inscription for start of the nuclear missile all can come to an end is sad)) code Duplication - and who forces it to do you by hands? Jam  - there are no problems add initialization separately. I hope  on  languages is not present. We take any pearl: #!/usr/bin/perl my $name ='Msg '; my $uname=uc ($name); open (my $h1, '> ', "$name.h"); open (my $h2, '> ', "$name-def.h"); open (my $c1, '> ', "$name.cpp"); print $h1 <<TEXT//$name.h #pragma once struct $name {typedef const char* Strings; static Strings TEXT; print $h1 "\t\t"; print $h2 "//$name-def.h\n\n"; print $c1 <<TEXT//$name.cpp #include "$name.h" #ifndef $ {uname} _LANG_FILE #include "$name-def.h" #else #include $ {uname} _LANG_FILE #endif $ {name}:: Strings TEXT; my $comment = "", $nf=0, $idx=0; while (<DATA>) {next if / ^ \s * (# | $)/; my ($nam, $val) = / (\w +)\s + (. *)/; if ($nf) {print $h1 ", $comment\n\t\t";} $idx ++; print $h1 "$nam"; $comment = "\t//$idx - $val"; my $mn=uc ("$ {name} _ $nam"); print $h2 "#define $mn\t/* $ idx*/\" $ val \"\n"; if ($nf) {print $c1 ", \n";} print $c1 "/ * $ idx* / $ name:: $nam = $ mn"; $nf=1;} print $h1 "; $comment\n}; \n\n"; print $c1 "; \n\n"; close $c1; close $h2; close $h1; __ DATA __ # here strings as name value hello hello world world text line1\nline2 \"1\t23 \"\n # comments After start on an output://Msg.h #pragma once struct Msg {typedef const char* Strings; static Strings hello,//1 - hello world,//2 - world text;//3 - line1\nline2 \"1\t23 \"\n};//Msg.cpp #include "Msg.h" #ifndef MSG_LANG_FILE #include "Msg-def.h" #else #include MSG_LANG_FILE #endif Msg:: Strings/*1*/Msg:: hello=MSG_HELLO,/*2*/Msg:: world=MSG_WORLD,/*3*/Msg:: text=MSG_TEXT;//Msg-def.h #define MSG_HELLO/*1* / "hello" #define MSG_WORLD/*2* / "world" #define MSG_TEXT/*3* / "line1\nline2 \" 1\t23 \"\n" If any macro from Msg-def jam while translating the compiler politely .

18

Re: Simple method static language wanted

Hello, _hum_. I will not say that it is simple, or that it should be used, but as a variant: http://rsdn.org/forum/cpp/6200693.1 the Author: wander Date: 02.10.15 And change of language in the course of operation is present, but does not affect almost productivity.