How to localize Firefox SDK Add-on name and description? - json

I'm developing an add-on for Firefox and I now wish to localize the name and description of the add-on itself, as visible to the user in the Add-ons Manager menu.
However, the guides I've seen online only seem to mention preferences in package.json and nothing about the name of the add-on or its description. I have tried to apply the suggestions for preferences to the name/description fields and haven't had any success - it will always appear in English.
Is localization of these fields even possible?

There is currently no way to do this from package.json. Read bug 661083 for more details.
However, there is a workaround: Manually edit install.rdf to add em:localized properties.
To do this you'll need to use the SDK to package your app into an xpi file. Then open the xpi (it is a zip file) and you'll see install.rdf in the root of the directory.
The MDN article Localizing extension descriptions describes what structure the em:localized properties needs to have.

This functionality has been added to the jpm tool recently (February 2016, see issue 495). Make sure that you use a recent jpm version, then the following code in package.json will work:
"title": "Default add-on name",
"description": "Default add-on description",
"locales": {
"de": {
"title": "Add-on name in German",
"description": "Add-on description in German"
},
"ru": {
"title": "Add-on name in Russian",
"description": "Add-on description in Russian"
},
}

Related

How to configure "Commit text links" feature in SourceTree for windows across many repositories

TL;DR: SourceTree for Windows recently added the "commit text links" feature, but it appears that the replacements must be set up per-repository. Is there a way to apply them globally or a config file that could be modified programmatically to set them?
Long version: The "commit text links" feature looks incredibly useful but I have a bit of a problem: We have about a dozen JIRA projects and over 25 repositories that each of them could be related to (none of them are 1-to-1 mappings). While I could set up a single regular expression to match each of the JIRA projects, it's a bit much to ask all of my developers to set it up through the UI for each and every repository. To really take advantage of this I ideally need to be able to give them instructions on a single file to modify or I need to generate a setup script that I can distribute to our developers.
Is there a config file that this setting is saved in? I was expecting to see it in something like .hg/hgrc but I couldn't find anything. I also couldn't find any relevant settings in the SourceTree Program Files folder.
Alternatively, is there a global or default setting that can be applied across all repositories? That plus the regex version could make setup significantly less painful if still manual.
Thanks!
(Note: I'm in version 1.3.3.0 of SourceTree for Windows, which I believe is the most recent stable version)
May be a bit late, but I've found a relatively easy way to do this.
Underneath your .hg/.git folder within your repository should exist a file called 'sourcetreeconfig.' This is where the links live and can be manually edited.
First make sure that you have closed all of the existing repository tabs within sourcetree, and additionally close sourcetree afterwards. Then, (assuming you have already configured a repository) copy the block from the respective repository's sourcetreeconfig and do a replace across all of your sourcetreeconfig files. This would be if you have multiple tied to the same project. It should be relatively easy to throw something together that can configure for different projects, just replace the url/project within the config.
Upon reopening sourcetree, each of your repositories should reflect this change.
This was performed using version 1.6.5.0 of sourcetree.
Programmatic Solution
Here in late 2019, the ability to globally configure commit text links in Sourcetree 3.2.6 for Windows still does not exist. Since this question was one of the few hits with a decent answer, I figured I would add an automated solution to the answers. I'm not a programmer, and I know the RegEx isn't the best, but this simple PowerShell script I cobbled together gets the job done. Make sure Sourcetree is closed before you run the script.
Copy the sourcelinker script into a Notepad++ or similar text editor application.
In order get the specific string for your setup, configure one of your Git repos with one or more commit text links specific to your organization.
A. Launch Sourcetree, select a Git repo, and click Settings.
B. In the Repository Settings window, click the Advanced tab.
C. In the Commit text links area, click Add.
D. From the Replacement type drop-down list, select Other.
E. Enter the Regex pattern and Link to URL for your specific setup, and click OK.
F. In the Repository Settings window, click OK.
G. Close Sourcetree.
Navigate to the .git sub-directory of the repo you configured, and open sourcetreesonfig.json.
Copy everything starting with "CommitTextLinks": [ through the closing bracket and comma ],. For example:
"CommitTextLinks": [
{
"$id": "11",
"LinkType": 99,
"Regex": "[fF][bB][#\\s]*(\\d+)",
"LinkToUrl": "https://companyname.fogbugz.com/f/cases/$1",
"Project": null,
"RootUrl": null,
"Description": "[fF][bB][#\\s]*(\\d+) => https://companyname.fogbugz.com/f/cases/$1"
}
],
Paste the copied content into your sourcelinker script between the single quotes that follow $New1 =.
Save the script as sourcelinker.ps1.
Copy sourcelinker.ps1 to the root folder where your Git repos reside.
Right-click the script, and select Run with PowerShell.
Launch Sourcetree, and check the Commit text links for your other Git repos.
Sourcelinker script
This script example contains Regex examples that link to Fogbugz and handles variations such as:
case12345
fb12345
bugzid12
Script
# Sourcelinker script
$InputFiles = Get-Item ".\*\.git\sourcetreeconfig.json"
$Old1 = '"CommitTextLinks": null,'
$New1 = '"CommitTextLinks": [
{
"$id": "9",
"LinkType": 99,
"Regex": "[bB][Uu][gG][sSzZ]\\s*[Ii][Dd]s?\\s*[#:; ]+(\\d+)",
"LinkToUrl": "https://companyname.fogbugz.com/f/cases/$1",
"Project": null,
"RootUrl": null,
"Description": "[bB][Uu][gG][sSzZ]\\s*[Ii][Dd]s?\\s*[#:; ]+(\\d+) => https://companyname.fogbugz.com/f/cases/$1"
},
{
"$id": "10",
"LinkType": 99,
"Regex": "[cC][aA][Ss][Ee]+\\s*(\\d+)",
"LinkToUrl": "https://companyname.fogbugz.com/f/cases/$1",
"Project": null,
"RootUrl": null,
"Description": "[cC][aA][Ss][Ee]+\\s*(\\d+) => https://companyname.fogbugz.com/f/cases/$1"
},
{
"$id": "11",
"LinkType": 99,
"Regex": "[fF][bB][#\\s]*(\\d+)",
"LinkToUrl": "https://companyname.fogbugz.com/f/cases/$1",
"Project": null,
"RootUrl": null,
"Description": "[fF][bB][#\\s]*(\\d+) => https://companyname.fogbugz.com/f/cases/$1"
}
],'
$InputFiles | ForEach {
(Get-Content -Path $_.FullName).Replace($Old1,$New1) | Set-Content -Path $_.Fullname
}
Solution inspired thanks to suggestion by Andrew Pearce from this thread.

Error :Submitting the app to Firefox Market Place

I am trying to submit a new app into the firefox marketplace but I don`t know why it is showing the below error..
Your app failed validation with 1 error.
Error extracting manifest from zip file.
I cannot install it through server to b2g mobile too as mentioned here.. as it is saying "Download Failed in the mobile.
Here`s my manifest file
{ "name": "Check Location", "description": "This app allows you to check your Location!", "launch_path": "/app.html", "developer": { "name": "RB", "url": "http://nothing.me" }, "icons": { "16": "/img/icon16.png", "32": "/img/icon32.png", "48": "/img/icon48.png", "64": "/img/icon64.png", "128": "/img/icon128.png" }, "default_locale": "en", "permissions": { "geolocation": {
"description" : "Marking out user location"
} } }
Here`s package.manifest
{ "name": "Check Location", "description": "This app allows you to check your Location!", "launch_path": "/app.html", "developer": { "name": "RB", "url": "http://nothing.me" }, "icons": { "16": "/img/icon16.png", "32": "/img/icon32.png", "48": "/img/icon48.png", "64": "/img/icon64.png", "128": "/img/icon128.png" }, "default_locale": "en", "permissions": { "geolocation": {
"description" : "Marking out user location"
} } }
I have done pasting Index.html, css and js folder into the package folder and zipped it as they have mentioned. But when I upload the zip file into the market place it is showing the error.. Please help me with this.. Check out the complete code Here
The error simply denotes that system cannot find manifest.webapp from your zip file.
https://github.com/mozilla/zamboni/blob/master/mkt/developers/forms.py#L512
You should make sure manifest.webapp is in root directory of your .zip file.
One possible mistake might be doing like below:
zip -r foo.zip foo/*
This will create a zip file whose root only contains foo folder, thus the submission system cannot find your manifest.
You should instead do:
cd foo
zip -r foo.zip *
Hope it helps!
Do not zip the main folder of the app directly.if you saved your app content in a main folder then open folder select all the contents and then select compress or Zip option.Submit it to the Marketplace.
Without seeing the zip file it is hard to say what exactly is wrong. Is this a packaged or hosted app? For hosted apps, you do not need to zip the app and can just pass the URL of you manifest to the validator. Of course, you have to first upload the app to it's unique domain.
There is a mailing list for webapp developers (dev-webapps) and one to contact app reviewers (app-reviewers). I would try dev-webapps since you have not submitter your app for review yet. But both of those channels are pretty responsive.
There are also a number of useful irc channels on irc.mozilla.org that you could use:
#openwebapps would probably be best place to ask about your issue
#marketplace also another good place to ask about marketplace issues
#app-reviewers any question about the review process
I hope that helps a bit. If you insist on getting an answer here, please provide the information I asked and a link to the zip file so I can take a look. Cheers!
I had the same message 2 days ago. I was confused, because it talked about manifest instead of manifest.webapp as usually documented as being required.
Uncertain about my understanding I copied my manifest.webapp to manifest and included it to my Zip.
Believe it or not, the Zip was accepted now.
Later I tried to verify the issue and removed the webapp, but now the Zip was still accepted as it should have been from the beginning.
Maybe, if nothing else helps you might give it a try.

How to set sublime-text to always show auto-complete suggestions

The code completion feature works really well when I type Java code, but I've recently made a build system for Modula-2, and while the auto-complete works when I press ctrl+space, it doesn't suggest the words on it's own. I have to hit ctrl+space every time, which (kind of) defeats the purpose.
I realize that modula-2 is not a very popular language, but sublimetext has a nice feature which remembers every word the user writes, and uses it in the code-completion. This is why the ctrl+space combo works in the first place. Does anyone know how to enable the suggestions?
What triggers the pop up is controlled by the auto_complete_selector setting. You will need to add the proper scope to that. If you are not using a syntax highlighter for those files, I believe this will apply the source scope to the file, which will then lead the pop up to show.
{
"name": "Modula-2",
"scopeName": "source.modula-2",
"fileTypes": [""],
"patterns": [
],
"uuid": "f8005a03-62cf-460b-84be-1184508464ed"
}
This is the JSON form, you can use PlistJsonConverter to convert to a plist. Then save that as a .tmLanguage file in the packages folder, probably the User Directory, or maybe a Modula-2 directory if you have other stuff associated with those types of files.
You should try Modula-2 Language Sintax it is a new package. You can install it using Package Control or simply by git clone git://github.com/harogaston/Sublime-Modula-2.git

How to apply javascript formatting to .json files?

The Ctrl + Shift + F hotkey in Eclipse can format a file. It doesn't work for .json files. How to make it work?
You'll want to get the JSON Editor plugin if you don't already have it. You can find it here
The JSON Editor is a simple plugin for the Eclipse IDE that provides: - Color text highlighting - An Outline Tree view - JSON validation - Text formatting - Text folding for the JSON data format.
If the hot keys still don't work. Take a look under the menu as shown in the picture from their site here
Also, I see that there has been at least one issue with what looks to be the current versions formatting feature in the past.
From their discussion site:
rlespinola
2010-07-15 00:18:05 UTC
Using version 0.9.4, I do not see the option to "Format Text". Also, when I open a .json file, the outline view says "An outline is not available".
jdschulteis
2010-12-27 16:59:24 UTC
Using 0.9.4 on Helios, I also had "An outline is not available". I went to Window->Preferences->General->Editors->File Associations, selected '*.json' in the 'File types:' list, selected 'Json Editor' in the 'Associated editors:' list, and clicked 'Default'. I now get an outline, though it can be somewhat slow (6K line file).
Edit:
There are several ways to add a plugin. Eclipse recommends using the update manager.
Try help > software updates > find and install
You can look here for some alternative methods.
There are two options I figured out using Eclipse Luna (4.4.0).
Use a JSON Editor Plugin and define shortcuts
Download and install the JSON Editor Plugin from sourceforge manually or use the Eclipse marketplace (Help -> Eclipse marketplace) to find and install the plugin
Go to Window -> Preferences -> General -> Keys and filter for "format text".
Choose "Format Text" and set the "When:" value to "Editing Text" (sadly there is no explicit condition for JSON editing, but the format event for the JSON Editor is different to the other editors, so "Editing Text" will work aswell)
Set the "Binding:" to Ctrl + Shift + F
Use the Javascript Development Plugin with an ugly and anoying workaround
Get the plugin using Help -> Install New Software -> Work with: "http://download.eclipse.org/releases/luna" -> Programming Languages -> JavaScript Development Tools
Associate *.json files with the JavaScript Editor (Window -> Preferences -> General -> Editors -> File Associations)
You can now create files with "json" extension and edit them in Eclipse using the JavaScript Editor, but formatting with Ctrl + Shift + F will not work directly with the following unformatted example:
{"addressbook": {"name": "John Doe",
"address": {
"street": "5 Main Street", "city": "San Diego, CA", "zip": 91912
},
"phoneNumbers": [
"619 555-3452",
"664 555-4667"
]
}
}
The hack is to create a valid JavaScript variable from the object description like this:
var obj = {"addressbook": {"name": "John Doe",
"address": {
"street": "5 Main Street", "city": "San Diego, CA", "zip": 91912
},
"phoneNumbers": [
"619 555-3452",
"664 555-4667"
]
}
}
Using Ctrl + Shift + F will now work
In the end you will have to remove the "var obj =" hack to make the JSON file valid again
You could use the JavaScript editor that ships with Eclipse.

Setting the Default Search Provider on Chrome via a script

I am attempting to set various Google Chrome preferences via a script (on both OS X and Windows). I can successfully set a number of preferences, and add bookmarks, by editing the Preferences and Bookmarks json files in the user's Application Data folder. However, when i attempt to set a new default search provider, the browser automatically reverts to Google search.
The default search provider node in the Preferences file looks like this:
"default_search_provider": {
"enabled": true,
"encodings": "UTF-8",
"icon_url": "http://www.google.com/favicon.ico",
"id": "2",
"instant_url": "{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1",
"keyword": "google.com",
"name": "Google",
"prepopulate_id": "1",
"search_url": "{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}",
"suggest_url": "{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}"
}
In order to add my desired search provider, I've simply added it manually (via the wrench menu), viewed the effect of this action on the json file, and then written a script to mimic these changes. However, when I change it via a script, the default search provider is used for the first search, but then resets the next time chrome is started. What am i missing here?
as mentioned, you should edit the 'Web Data' file, which is an sqlite database.
To add a search engine, add an entry to the 'keywords' table.
To change the default search engine, edit the 'Default Search Provider ID' value inside the 'meta' table.
If you want to change the default search provider in Google Chrome you have to modify 'Web Data' file wich is an SQLite file.
On my computer the location where you can find the file is C:\Users\daniel\AppData\Local\Google\Chrome\User Data\Default(Windows7).
See the content of file with SQLite Database Browser; you can find one here.
Despite everybody here suggesting to write to Chrome's Sqlite DB, the same can be achieved via JSON based config files (as noted above by https://stackoverflow.com/users/49572/andreas-huber).
The relevant documentation can be found here:
https://www.chromium.org/administrators/policy-templates
https://www.chromium.org/administrators/linux-quick-start
https://www.chromium.org/administrators/policy-list-3#DefaultSearchProvider
For Chrome on Linux putting something like this into /opt/chrome/etc/policies/recommended/duckduckgo.json shoud get you started:
{
"DefaultSearchProviderEnabled": true,
"DefaultSearchProviderName": "DuckDuckGo",
"DefaultSearchProviderSearchURL": "https://duckduckgo.com/?q={searchTerms}"
}
On Windows and OSX and with Chromium the places to set this are different, but are all documented under the above given URLs.
A solution that is working for Chromium and Chrome on Ubuntu can be found here:
https://github.com/andreashuber69/os-setup/blob/master/common/reset-browser-preferences
Besides setting the default search provider, the linked script further customizes Chromium/Chrome to my liking. For Chrome, the part relevant to the question goes like this:
# Modify the preferences relevant to the default search provider
cat ~/.config/google-chrome/Default/Preferences | jq '.default_search_provider_data.template_url_data={ "keyword": "duckduckgo.com", "short_name": "DuckDuckGo", "suggestions_url": "https://duckduckgo.com/ac/?q={searchTerms}&type=list", "url": "https://duckduckgo.com/?q={searchTerms}&t=canonical" }' >adapted-preferences.json
mv adapted-preferences.json ~/.config/google-chrome/Default/Preferences
This simply adds a new entry to the list of search engines and sets it as default. If you want to select an existing one, things are little more complicated (see script for details). The above requires the package jq, which is not present out of the box on Ubuntu.
Contrary to other posts, it seems no longer possible to set the default in the meta table. It must be done through the Preferences file as shown above.