Sk
Hello my friends I am from India I need online work someone please tell me
Abbasi
Seems https://cppquiz.org/ is more constructive.
Vlad
Seems https://cppquiz.org/ is more constructive.
Why the hell do you have #opentowork on your pfp in telegram? It aint linkedin brutha
Abbasi
Why the hell do you have #opentowork on your pfp in telegram? It aint linkedin brutha
I really need to work that’s why I use that pfp. LinkedIn is like a social media and it contains fake jobs I suppose. I try to use indeed or xing instead.
ж
va bene così
Ludovic 'Archivist'
Abbasi
Nah, HR people just do not hire people with the open to work banner because "they look desperate"
Are you sure about that? If so, 1- Are those who have that pfp on LinkedIn also doing wrong? 2- How should an HR know if someone is hired or looking for a job?
Ludovic 'Archivist'
Are you sure about that? If so, 1- Are those who have that pfp on LinkedIn also doing wrong? 2- How should an HR know if someone is hired or looking for a job?
No idea, I don't work with HR nowadays, but when conversing with them, they seem more set on poaching employees than in hiring job seekers. So I would say that unless you are looking for a low-ball offer, you should not use that banner on LinkedIn
Pavel
That goes too much into OT, but I want to add my 2 cents. I feel like getting through the hiring process is a lot like dating. You need to look interesting as a hire candidate to give a good first impression. They shouldn't ask themselves a question "Why is he unemployed/can't find a job right away? Is there something off?"
Vlad
You having a job and not looking even increases chances of getting offers on there
Rose
Reported Sarah Vine [6641300082] to admins.​​​​​​​​​
Cayetano
Hi guys! I'm wondering if I should create from scratch a i18n module to translate the string into the app or there are any library or Github repository that could make easy the translations. It would be amazing if the translations will be stored in JSON files Any clue guys?
Cayetano
Well, it is great but is not exactly that I would like...
Cayetano
I'm looking for a library that let to load a json file with translations like { "moon": "Moon", "sun": "Sun", "animals": { "cat": "Cat" } } And using like translate('moon') giving the translation in the locale settings, in this case en_US, and it should be 'Moon', but if you change your locale to es_ES it would be 'Luna' according with the file named es_ES.json, of course
Cayetano
It would be great to provide a way to manage the fallback, but if not, I can handle it
Cayetano
I have using https://github.com/stefandevai/i18n_keyval/tree/main but I can find any way to load the file, that library was created thinking to have multiple translations... And I don't know if it will be the best approach for me
Abbasi
Are you by any chance going to provide an application UI with multiple languages for the user to choose based on their preference?
Sarah
Happy new month
Cayetano
Are you by any chance going to provide an application UI with multiple languages for the user to choose based on their preference?
Yes, I will provide two segments one for the UI and the App and one for the Game. The App will support several languages and the translations will be readonly but the game will be compiled using only one. Anyway, I will need to keep in memory two objects of translations,one readonly and another writable
Cayetano
But I was thinking about how to implement and what I really need and, to be honest, I'm thinking about implementing the module by myself, although I don't know if it will be a good idea
Abbasi
I did something similar in my last role (in an automotive project for a German company) The GUI library we used was Dear ImGui however. I used a std::map per language with fixed keys and different values, in one of headers.
Pavel
Yes, I will provide two segments one for the UI and the App and one for the Game. The App will support several languages and the translations will be readonly but the game will be compiled using only one. Anyway, I will need to keep in memory two objects of translations,one readonly and another writable
Game Engine Architecture book (at least the last edition), has an explanation of how translation tables are done in game engines. Though I think they talk only about the read-only part. For the tooling part, I think Unreal Engine has some decent examples, though not perfect. For a small scale project one can also store translations as XML and use something like google docs as an editor, which could be useful for translators as well.
Ludovic 'Archivist'
C++26 has been frozen. Details should be on cppreference in a couple of weeks
Cayetano
🙏 thanks
Ludovic 'Archivist'
Could you write the Url, please?
You will have to wait for it to be published on the ISO website, it costs about $150 to buy a copy when it does
Vlad
I aint gonna say nothing that you can read drafts for free
Ludovic 'Archivist'
I aint gonna say nothing that you can read drafts for free
While the standard is frozen, the draft has not been updated yet to the standard, soon ™️
Abbasi
Apologies by delay, hard day... That is exactly what I've thought. A std:map and a structure to manage the languages.... 🤔
You can have an enum class Key with strings as your default terms and then as many std::map<Key, const char*> s for your languages. Make them inline if you're gonna have them in a library. eg: inline const std::map<Key, const char *> englishLan{ ... };
Abbasi
You can have an enum class Key with strings as your default terms and then as many std::map<Key, const char*> s for your languages. Make them inline if you're gonna have them in a library. eg: inline const std::map<Key, const char *> englishLan{ ... };
This method increases compilation time - as it has more code. The other way is to have the pairs in a json file. There're many good json libs here and there. We used nlohmann json at the time. This way you will load the language files at runtime hence less compilation time but higher run-time. I personally preferred the std::map version.
Vlad
It's literally mapped on an array 1-to-1
Abbasi
Not sure what you mean by "basic enum", "retarded" and "1-to-1". Using std::map we can achieve unique keys and fast look-up. While keys are unique, values can be the same which can happen for languages too. What other method would you go for instead?
Cayetano
Thanks for ideas, I have thought something like this: std::unordered_map<std::string, std::unordered_map<std::string, std::string>>; What do you think about it?
Vlad
Hence the index of array will map the KEY exactly
Vlad
What's the problem then?
std::map is not needed
Abbasi
We use an enum class not enum
Ludovic 'Archivist'
Vlad
Unless your enum has non sequencial values you should not use std::map
Vlad
Furthermore its mapped using arrays in C all the time
Ludovic 'Archivist'
Unless your enum has non sequencial values you should not use std::map
even then unless your enum is very big, linear search will be faster
Cayetano
Regarding the list of supported languages, I will store as two parts, one, as #define to store the identifier, and another as std::map to store the relationship between the #define and the string... Some like this: #define SPANISH_ARGENTINA "es_AR" #define SPANISH_BOLIVIA "es_BO" ... ... and inline std::map<std::string, std::string> languages = { {"es_AR", "Spanish (Argentina)"}, {"es_BO", "Spanish (Bolivia)"}, .... };
Vlad
Or es_AR is a part of the programming interface?
Cayetano
Well, not convert, but I will need the relationship to show to the user a dropdown where he can select the user (name) and return the code
Vlad
enum class lang {...}; std::string lang_short[lang::count]; std::string lang_description[lang::count]; ... const auto& lang_code = lang_short[(int)lang::es_AR]; const auto& lang_desc = lang_description[(int)lang::es_AR];
Vlad
Something like this
Vlad
You may make arrays const as well
Vlad
Good enough, and less annoying to use
Ludovic 'Archivist'
Or char[6]
char[6] would do twice the cache eviction of uint32_t
Vlad
char[6] would do twice the cache eviction of uint32_t
Yeah, I don't think he's gonna have so many languages it would ever make a difference
Abbasi
Hence the index of array will map the KEY exactly
In enum class Key { One, Two }; int main() { const std::map<Key, const char *> englishLan{{Key::One, "one"}, {Key::Two, "two"}}; std::map<Key, const char *> lan = englishLan; Something like lan[0] or lan[One] seems not possible. lan[Key::one] works fine. Perhaphs I didn't get what you meant.
Vlad
Duh
Cayetano
@Abbasi_dev Are you sure that your solution is more efficient than mine? @QNeko Could you explain a little bit more your suggestion, please?
Ludovic 'Archivist'
@Abbasi_dev Are you sure that your solution is more efficient than mine? @QNeko Could you explain a little bit more your suggestion, please?
enum and enum class are stored in memory as integers, size is system dependent but is always less than that of size_t. enum and enum class values start at 0 and go incrementing by one each time. By having an array that is ordered exactly like the enum members, you can take that array and do the_array[static_cast<size_t>(enum_value)] to map an enum to a value without requiring any extra memory fetch
Vlad
I get static cast for pointers and references though
Ludovic 'Archivist'
Is there any merit to static cast value types instead of C casts?
giving the right habit so that they don't slice the value, and also giving them the habit of not using C casts in general as they are quite unpredictable
Ludovic 'Archivist'
Aren't C casts exactly static casts for value types?
No, C casts can cast away and cast in const and volatile
Ludovic 'Archivist'
That is the main difference
Vlad
Aren't C casts exactly static casts for value types?
You can slice derived class to the base one with static casts too