uwp localization with 1 resource file for all variants of a language - xaml

I know how localization in uwp works and I currently have en-US and es-es Resouce files.
What I want to ask is can I just use 1 resource file i.e en and will that affect all variants of English language? like en-us , en-as and all others? and then 1 file for Spanish i.e : es and so on.
all language variants have only few differences between them which are negligible almost in my app. I noticed my app has most of its users from Spain and US only. I assume that is because I am only supporting these 2 languages right now. So I want to support all variants of Spanish and all variants of English but only with 2 files, would that work or do I need to provide 1 file for each variant?

Try checking first if the current app language is any english variant (en-US, en-AS, ...) and if it's true then override it with the one you want.
If ( CurretLanguage == "en-US" || CurrentLanguage == "en-AS" || ...)
{
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "en-US";
}

Yes, you can do it with single file by just using short language name. In your case, it should be Resources.en.resx for english and Resources.es.resx for spanish. You can refer here for language tags.

Related

Wiktionary API: Get tags for a word, and specify language

For example, if the word is dog, I want to get the following, but only the English section, not other language sections like ==Afrikaans==, ==Danish== and so on. What API should I use? I saw the API page, but it was difficult to understand. The only thing I could find was parse (https://en.wiktionary.org/w/api.php?action=parse&page=dog), but that gives me the HTML, not the tags, it has a warning "Unrecognized parameter: url", and I don't know how to specify the language.
[[Image:YellowLabradorLooking.jpg|thumb|A dog (a [[Labrador retriever]])]]
===Alternative forms===
* {{l|en|darg}}, {{l|en|dawg}}, {{l|en|dug}} {{qualifier|dialectal}}
* {{l|en|doggie}}, {{l|en|doggy}} {{qualifier|childish}}
===Pronunciation===
* {{a|RP}} {{IPA|en|/dɒɡ/}}
...
This looks to do what you want:
https://en.wiktionary.org/w/api.php?action=parse&page=dog&section=1&prop=wikitext
You probably want to check that it starts with ==English==, but I think if you are using en.wiktionary, section 1 will always be English.

Adding a new language to the Odoo ERP

I want to add a new language to the Odoo openERP (installed on the local machine) which is not on the list of its languages.
I changed the string in some .po files but it did not affect the translated view in the app.
Any idea to change language easily by editing the .po file for other languages? for example changing the string of the fr.po to the desired one.
Here are the steps, I followed to add a new language (Sindhi) in odoo. After creating a language file (.po) follow these steps, make sure to replace language with whatever you want to add:
Step 1 - Activate developer mode.
Step 2 - From Settings --> Translations --> Import / Export, import translation file (.po) with Sindhi / سنڌي as Language Name, sn_PK as code
Step 3 - After importing, you should see the Sindhi / سنڌي in settings --> Translations --> Languages.
Step 4 - Now you can set your language from the user preference menu.

Bing Spell Check API works only in English

Trying Bing Spell Check API, but it doesn't seem to work correctly with languages other than English. Available languages for Spell Check
I've tried to check French text, but the results will actually suggest mistakes to a perfectly fine text and vice versa (meaning it also won't correct a mistake in a text).
I've tried checking this text:
La Terre a un noyau interne solide
This is how I've passed the language:
var result = client.SpellCheckerWithHttpMessagesAsync(text: text, mode: "spell", acceptLanguage: "fr-FR").Result;
I've also tried setLang:
var result = client.SpellCheckerWithHttpMessagesAsync(text: text, mode: "spell", setLang: "fr-FR").Result;
The result suggested changing solide to solid which is wrong.
I've tried other texts as well as different languages with the same results.
Am I missing something in how to use this API?
Pls use market parameter mkt=fr-fr in the query and drop the setLang parameter.

Asp.NET database multi-lang design [Include HTML]

,
I read lots of answer here and learn something about this topic but I need more help.Some pages in my project are getting the html(page body) from database.For my controls I use resx files and it works great, but now I need save the html values with multi-lang in my database.
I have a admin panel for my project and I edit sometimes the html or text or pictures in my editor and save it back to DB.I cache the html values in my website and get better performance for my project.But the html text parts is yet in my default lang I will create multi-lang.
I thought of a few possible solutions,
First solution was copying all of the same HTML data and create for all lang one by one
First solution problem : But later this doesnt make sense If I copy the values and create for other lang, then I had be repeating unnecessarily in my database the html values.
My second solution was like this :
this I hid it in the normal way in my DB (only a part of html in one column)
<li>Hello World</li>
<li>Hello Me</li>
Solution :
<li>[HelloWorld]</li>
<li>[HelloMe]</li>
string newHtmlValue = oldValue.ReplaceByLang("[HelloWorld]", GetCulture();,"Hallo Welt");
***// GetCulture(); return for this example german !
I create a new table for the replace text like the key is [HelloWorld]
1(ROW)- [HelloWorld] eng Hello World
2(ROW)- [HelloWorld] german Hallo Welt
3(ROW)- [HelloWorld] fr bonjour tout le monde
and in my project I select the right html value by culture lang.
Now my question is have you any better idea ?
I hope I've been clear and not messy, but if you need more informations I'll be glad to tell you more.Sorry for english.
I would prefer to store all your localized string in single repository like - DB or Satellite assembly.
For Example if you choose DB as repository - Define 3 tables (minimal structure)
1.Locale - Define your locale
2.Resourcemaster - Define your source string and reference Key and this key should be unique in you application and define a standard format like Module_Control_Section ..
3.LocalizedResource - Define your localized sting of Resourcemaster with Locale Key. Foreign key with ResourceMaster and Locale
In front End you can resole any string like control , Html string with localized string and Unique reference key.
Also Implement UI Caching / API caching for better performance.
Regards
Abdul

Prestashop blocklayered reloadContent() returns wrong language

I have a problem using prestashop with blocklayered module, my shop's default language is French (id_lang = 1).
Here are the steps to get to the error:
I switch to English (id_lang = 4) and go to the product list page, all the products are written in English, no problem here.
Then, each time I try to use blocklayered filters, all the results returned are written in French instead of English.
I added var_dumps in the header and on the product-list.tpl to see the value of $cookie->id_lang. They are both set to 4 (English language). After using blocklayered, I still have the id_lang to 4 in header BUT, the one that is in product-list is now set to 1 which is the french id_lang.
PS version: 1.6.1.0
Blocklayered version: 2.1.3
The reloadContent() function in /modules/blocklayered/blocklayered.php calls the following function:
ajaxCall() in /modules/blocklayered/blocklayered.php
This function is using $cookie->id_lang to fetch the current language ID, try debugging the value of this variable.
You can also try replacing it with $this->context->language->id, it might fix your issue.