Forcing default l10n language in Firefox Extension - localization

I already read answers about placing a
default.properties
file or a
package.properties
, and even that the browser already detects the unique language as default, but it is not working.
I have my browser configured in french, and my partner had it in english. We are just implementing the extension in english, but when I run the extension in the french browser, it doesn not load anything.
I also read about having some properties in the package.json like:
"locales": {
"en": {
"name": "Open Web",
"description": "Come on!"
},
"fr": {
"name": "L'Open Web",
"description": "Allez!"
}
},
"default_locale": "en"
But didn't work.
I'm using last stable version of Firefox 42.0b1. Any idea?

You need to have a default en-US.properties file. That's the default if the user language is not supported by your extension.

Related

Microsoft Teams App localisation does not work anymore

We are trying to build a multilingual chatbot which supports English (en-us) as well as German (de-de). We had been using it on Microsoft Teams without any problems until around mid-June 2020. Thereafter, we noticed that the localization didn't work properly anymore. We also noticed that this was around the same time that Teams introduced manifest version 1.7. The following occurrence is observed:
If the Teams admin uploads the app while their MS Teams client language is en-us, all custom applications ignore the 'de-de' localization info, and all information, as well as commands, are displayed in English only, even if the client language for the users is German.
The exact opposite will happen if the language of the admin was de-de when they uploaded the application. All information from the bot will be in German, whereas the default language (English) will be ignored.
As a sample, I am sharing this screenshot.
Here, you can see that although the client language is German, the suggestion commands appear in English. In fact, the bot name and description are also in English. In fact, we observed that the same behaviour is also exhibited for the official manifest template from Microsoft.
Here are our manifest files:
manifest.json
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json",
"manifestVersion": "1.7",
"version": "1.0.0",
"id": "00000000-0000-0000-0000-00000000000",
"packageName": "com.sample.sample.sample.dev.bot3",
"developer": {
"name": "Sample Inc.",
"websiteUrl": "https:/sample.z6.web.core.windows.net",
"privacyUrl": "https://sample.z6.web.core.windows.net/privacy.html",
"termsOfUseUrl": "https://sample.z6.web.core.windows.net/tou.html"
},
"localizationInfo": {
"defaultLanguageTag": "en-us",
"additionalLanguages": [
{
"languageTag": "de-de",
"file": "de-de.json"
}
]
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "Manifest Test EN",
"full": "Manifest Test EN Bot"
},
"description": {
"short": "Manifest Test EN",
"full": "Manifest Test EN Bot"
},
"accentColor": "#40497E",
"bots": [
{
"botId": "00000000-0000-0000-0000-00000000000",
"scopes": [
"personal"
],
"supportsFiles": true,
"isNotificationOnly": false,
"commandLists": [
{
"scopes": [
"personal"
],
"commands": [
{
"title": "Personal Command 1",
"description": "Description of Personal Command 1"
},
{
"title": "Personal Command N",
"description": "Description of Personal Command N"
}
]
}
]
}
],
"staticTabs": [
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"sample.z6.web.core.windows.net",
"token.botframework.com"
]
}
Localization file de-de.json
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.Localization.schema.json",
"name.short": "Manifest Test DE",
"name.full": "Manifest Test DE Bot",
"description.short": "Manifest Test DE",
"description.full": "Manifest Test DE Bot",
"bots[0].commandLists[0].commands[0].title": "Persönlicher Befehl 1",
"bots[0].commandLists[0].commands[0].description": "Beschreibung des persönlichen Befehls 1",
"bots[0].commandLists[0].commands[1].title": "Beschreibung des persönlichen Befehls N",
"bots[0].commandLists[0].commands[1].description": "Das ist DE1"
}
We are experiencing the same issue here only we have been able to determine that the language the app is shown to the user is the language the app is installed with.
So in your case the app was propably installed when your Teams language was set to German, if you would now switch to another language the app would still be in German. We have tried this for multiple apps, multiple users and multiple tenants. The language used is always the one from the client the app is installed from, not the language the current user is using.
So for example when a App is installed with a client that is for example in German, the app will be configured in German for this user and all other users of the tenant the app is installed for. If the user that installed the app switched language (fe: English) to another supported language the language stays in German (even when the client is restarted). The same goes for other users, if a user at the moment of installation for example was using the application in English then the app will also be in German for that user and not English since it was installed by a user who had German as it's default language.
Could you please try updating the version to 1.2 in the manifest?
here is the result after updating the version

some words display as '?'' when using french language in MS Teams app localization(manifest 1.5)

Description: Teams display wrong values in app static tab and 'what can i do' input command
For example,value 'élément' display '�l�ment',it seems that Teams can not recognize the char 'é'
Manifest Version: 1.5
Language: fr-fr
Manifest.json
{
//hide bot other message
"localizationInfo": {
"defaultLanguageTag": "en",
"additionalLanguages": [
{
"languageTag": "fr-fr",
"file": "fr-fr.json"
}
]
}
}
fr-fr.json
{
"$schema": "https://developer.microsoft.com/fr-fr/json-schemas/teams/v1.5/MicrosoftTeams.Localization.schema.json",
"name.short": "Test",
"name.full": "TestFullName",
"description.short": "short description example",
"description.full": "full description example",
"staticTabs[0].name": "Nouveautés",
"bots[0].commandLists[0].commands[0].title": "Restaurer élément",
"bots[0].commandLists[0].commands[0].description": "Restaurer élément for test",
}
This issue has been solved when I check the installer bot package.It seems that the App Studio can not recognize some words like 'é'. So close this issue!
#Lin's Master, for all the French regions, you need to set your "languageTag" = "fr". Please follow this documentation.

Allow sharing a file in iOS on standalone mode in a WebApp

I have a WebApp and it works alright in both Android and iOS environments. The problem is, in one of the screens, the WebApp generates (and displays) a PDF file, which should be shareable through Email, WhatsApp, Telegram, etc.
Android does allow the share option in the standalone display mode, but iOS just doesn't. I need to know if there's any way I can actually exit the WebApp mode into plain good-old-browser mode when opening the pdf file, so that the user can actually share it with his/her contacts through the browser's native share dialog.
These are the contents of the manifest.json file
{
"name": "Test App",
"short_name": "TestApp",
"icons": [
{
"src": "/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "https://example.com?a2hs=1",
"scope": "/",
"display": "standalone",
"orientation": "portrait",
"background_color": "#000000",
"theme_color": "#000000"
}
So far, I've tried:
using Display PDF in the pdf link.
using javascript to force-open a new window:
test
<script>
$(function(){
$('#pdf').click(function(e){
e.preventDefault();
window.open($(this).attr('href'), '_blank');
return false;
});
});
</script>
None of those solutions worked out.
Also, I tried changing the display: property in the manifest.json file to minimal-ui - that does allow to share the file/url but that removes the WebApp look & feel, so it's not an option.
Any ideas? Thanks!
I managed to find a solution. I created this alias subdomain:
pdf.example.com
Then, I linked the pdf to the alias subdomain:
Display PDF
iOS recognizes this as another server, so it automatically forces the load of the file in a new tab in Safari, exiting the current standalone mode of the webapp.

Firefox webextension: Save page as html or text

With the new firefox webextensions: Is there a way to save the current page (or a part of it) as html (or text) to disk? If not, how are the chances, such an API will be implemented in the future?
I didn't find any suitable API and appreciate any help.
Regards
There are probably several ways to do this. The following will get you started. It saves the webpage in the currently focused tab in the active window to the browser's default downloads path. The file name is set to 'samplePage.html' (you can change that by modifying the filename value in the downloads.download() options; or you can remove that field entirely and leave it to the default naming).
You will need to store icon images in your webextension package for the user to be able to click on. Also, be sure to navigate to a webpage you want to save before you try to use the webextension; webextensions are not active on the Firefox about:debugging page.
manifest:
{
"name": "SavePage",
"version": "1.0",
"description": "Clicking browser icon saves page html",
"manifest_version": 2,
"icons": {
"48": "icons/clickme-48.png"
},
"permissions": [
"tabs",
"activeTab",
"downloads"
],
"browser_action": {
"default_icon": "icons/clickme-32.png"
},
"background": {
"scripts": ["background.js"]
}
}
background script:
/* BACKGROUND SCRIPT
Clicking on browser toolbar button saves the webpage in the
current tab to the browser's default downloads path with a
filename of "samplePage.html". The "tabs" and "downloads"
permissions are required.
*/
browser.browserAction.onClicked.addListener((tab) => {
var currentUrl = tab.url;
function onStartedDownload(id) {
console.log(`Started to download: ${id}`);
}
function onFailed(error) {
console.log(`Something stinks: ${error}`);
}
var startDownload = browser.downloads.download({
url : currentUrl,
filename: 'samplePage.html'
});
startDownload.then(onStartedDownload, onFailed);
});
An alternative approach might be to try to save the webpage to local storage rather than to disk. I have not explored that option.
These pages may be helpful:
downloads.download()
browserAction.onClicked
There may be security risks in giving a webextension these permissions. You will have to weigh the risks for your own usage pattern.

How to use popup.html from URL in Chrome Extension?

I want to create an extension for Google Chrome, and it will be real simple.
I will have a database on my website's server, it will check if a URL is in the "blacklist" table, and warn the user if it is.
But I don't know where to start. I tried putting all the files on my web server, and changin the manifest.json file as such:
(changed the "default_popup" line)
{
"manifest_version": 2,
"name": "My Extension",
"description": "This extension warns you if you are trying to open a blacklisted URL",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "http://www.mysite.com/my_extension/popup.html"
},
"permissions": [
"https://secure.flickr.com/"
]
}
Note : this file resides on my computer, I load it from the "Extensions" menu of Chrome.
but when I tried to install this extension, I got the error :
This web page could not be found:chrome-extension://hgfdjnsakhkijfmdnadmlacgjggggkpf/http://www.mysite.com/my_extension/popup.html
Instead of trying to hard code it in the manifest file, try putting something like this in a background page:
chrome.browserAction.setPopup({popup: "http://www.mysite.com/my_extension/popup.html"});
However, it may not be possible to specify an external popup page at all.
Nevertheless, it would be better to include the popup in the extension files and then get just the data from your server.

Resources