Boarding pass not getting localization strings - passbook

I've been developing a boarding pass, everything went fine, but when I tried to internationalize it passbook is not loading strings. The pass works fine but is not getting localized strings. The odd thing is that it works fine on pass viewer, but on iphone and ipad it doesn't.
This is my manifest.json file:
{
"pass.json": "41ea636799de90475196cdf17f879653aa256e61",
"icon.png": "6762942886bae7b11ad45f268faf082dcfe15ea7",
"icon#2x.png": "d9de89daee9f8b24d6059018ab107b33e9efb744",
"logo.png": "d63334e60ad0548b1bf07a0d6e133a8ccdb09f52",
"logo#2x.png": "0ff3913da7f122a9f5d44ff3ad8c44e2fc06f24c",
"en.lproj/pass.strings": "64c8e3def5193f82be5bea65ae10e2d0eb4ba3fa",
"es.lproj/pass.strings": "beb344e5657994008bd1be5bda8c20347420b389"
}
this is part of the pass.json when I am trying to internationalize a string.
"headerFields": [
{
"key": "seat",
"label": "seat_str",
"value": "{seat}",
"textAlignment": "PKTextAlignmentNatural"
}
],
and this is en.lproj/pass.strings
"flight_str" = "FLIGHT";
"seat_str" = "SEAT";
"depart_str" = "DEPART";
"gate_str" = "GATE";
"plane_str" = "PLANE";
"passenger_str" = "PASSENGER";
Is it correct to include the en.lproj in the manifest file? Am I missing something in the pass.json file?
EDIT: Finally I found the problem, it was not on the pass itself, the issue was in the way I made the zip file. I was generating the zip file in .net and was adding pass.strings this way
var englishLocalizationEntry = archive.CreateEntry(#"en.lproj\pass.strings");
using windows file system path separator. For making it work correctly I had to change it to
var englishLocalizationEntry = archive.CreateEntry(#"en.lproj/pass.strings");

Related

Firestore document with umlaut, two different "ö"

My problem is, when I try to set up a new document in my firestore with a name including umlaut "ö" it writes it in a worse way. Can you compare both documents and tell me what the difference between these two "ö" are? In the first picture the "ö" is bigger than in the second picture. Because of that my further functions - for example search function which is looking for the document name - is not working for document names with umlaut. I can't figure out the answer of my problem. I hope you guys can show me the right way to handle this. I don't want to replace the umlauts.
Should I decode my variable which I pass as the document name in my setup function?
First image:
Second image:
Update:
I will explain a little bit more about my goal. I have an index.html upload form for multi-image upload to Firebase storage and writing the imageurl and other information to the |irestore. When I upload my image folder, I retrieve the path of the imagedata from my system and make a split to have only the foldername. I use this name as the document name for my firestore (it is working for folders without an umlaut in the name). But when I write the same name for creating a document through the firebase console or replace it with a variable text = "my string for foldername" it is not matching. I would say the retrieved foldername has a different coding for example for the letter "ö".
var relpath = files[i].webkitRelativePath;
folder = relpath.split("/");
var foldername= "";
//foldername = unescape(encodeURIComponent(folder[0]));
foldername = folder[0];
var storage = firebase.storage().ref().child('kitaDE/duesseldorf/'+foldername+'/'+files[i].name);
//upload file
var upload = storage.put(files[i]); //webkitRelatviPath hinzugefügt
//update progress bar
upload.on(
"state_changed",
function progress(snapshot) {
var percentage =
(snapshot.bytesTransferred / snapshot.totalBytes) * 100;
document.getElementById("progress").value = percentage;
},
function error() {
alert("error uploading file");
},
function complete() {
document.getElementById(
"uploading"
).innerHTML += `${files[i].name} uploaded <br />`;
},
);
db.collection("kitaDE").doc(foldername).set({
image: [],
id: "",
active: true,
title: "",
street: "",
zipcode: "",
location: "",
})
Update 2
I copy & paste the foldername and my direct entry for the name over the firebase console.
Foldername copied:
Am Köhnen
Entered name in firbase console through my keyboard:
Am Köhnen
It looks for me the same. I run my javascript code and give out the following part on the console log.
var relpath = files[i].webkitRelativePath;
folder = relpath.split("/");
var foldername= "";
foldername = folder[0];
var foldername2 = "Am Köhnen";
var foldername3 = decodeURIComponent(escape(foldername2))
My result is the following screenshot.
Console.log Output
You can see that first name seems right, but first and the third output names are not matching. It seems like they are the same but they not, i refer here to my both picture at the begin of my post here. Firestore handle the names different.
To get a hex dump, I ran this command in the parent directory of the problematic one:
bash$ printf '%s\n' Am\K*hnen | xxd
00000000: 416d 204b 6fcc 8868 6e65 6e0a Am Ko..hnen.
There are multiple sequences that result in an ö character being displayed. One of them uses a single Unicode codepoint to represent the character (U+00F6), but the other actually uses a separate codepoint for the o and then another one for the umlaut (U+006F U+0308).
Also see:
The wikipedia page on combining characters
The wikipedia list of unicode characters
My first idea is that the two titles in your documents are written with different Unicode sequences.
I thought that Firestore would equate these two ways of writing, but I can't find anything in the documentation about that now. If it doesn't, then that would explain why a query that matches one of the codepoint combinations for ö doesn't match the other combination.

How to have PhantomJSCloud wait for imbedded javascript in content

I am passing an HTML string to PhantomJSCloud in the "content" of the page. The HTML has JS embedded in it inside script tags at the end of the string. When I return the jpeg that I am requesting from PJSC, the objects that the JS manipulates, have not been manipulated. I know the js works, because I can copy and paste the whole html string to a file, open it in chrome, and watch it happen.
It is using Chart.js, which has an animation option, but i have set it to false.
Currently my request JSON looks like this:
"pages": [
{
"content": "$$$CONTENT$$$",
"renderSettings": {
"quality": 100,
"selector": "[id='report']"
},
"requestSettings": {
"ioWait": 5000,
"waitInterval": 5000
}
}
]
}
Replacing the "$$$CONTENT$$$" with my actual HTML string. The whole request takes less than 5 seconds so the "waitInterval" doesn't seem to be what I'm looking for.
This turned out to not be an issue of whether it was waiting on the javascript. My javascript was manipulating text, and some of that text had a \n inside of it. It apparently needed a \\\n

createjs loadManifest, it should be loading files in manifest, correct?

If I understand the docs correctly… 
window.queue = new createjs.LoadQueue(true, null, true);
queue.loadManifest({src: manifest, type: "manifest"}, true);
should be loading the files that are located in the json file, correct? Not seeing any requests in inspector, only getting the results array in console. Do I have to loop over results array and do the loadFile manually?
JSON is formatted correctly in a {src:"",id:"",type:"createjs.Types.IMAGE"} structure.
Any help is appreciated.
Adding more code:
function to pass in manifest url
function loadImages(manifest) {
window.queue = new createjs.LoadQueue(true, null, true);
queue.loadManifest({src: manifest, type: "manifest"}, true);
queue.on("fileload", this.handleFileLoaded);
queue.on("progress", function(event) {
console.log("progress " + event.progress);
});
queue.on("fileprogress", function(event) {
console.log("file progress " + event.progress);
});
queue.on("error", function(event) {
console.log("file error");
});
queue.on("complete", function(event) {
console.log("queue complete");
console.log(event);
});
queue.load();
return queue;
}
handleFileLoaded event is just dumping event to console at this point.
Manifest with two examples
{
"path":"https://images.unsplash.com/",
"type":"manifest",
"manifest": [
{
"src":"photo-1542838454-d4dce2a7cfde?fit=crop&w=500&q=60",
"id":"stair_boy",
"type":"createjs.Types.IMAGE"
},
{
"src":"photo-1549948558-1c6406684186?fit=crop&w=500&q=60",
"id":"night_bridge",
"type":"createjs.Types.IMAGE"
}
]}
I get access to the manifest array in the fileload event, I can manually load the images from there, but that seems counterintuitive to the whole point of using the PreloadJS. Seems like on page load, Preload should load the manifest, recognize 'type'… loop through files and in network inspector I should see the web requests for the images.
The types in your manifest are incorrect. You are passing in a string value of "createjs.Types.IMAGE". This is not equal to "image", nor is it the equivalent of the JavaScript createjs.Types.IMAGE, since it is interpretted as a string.
Instead use the string value "image"
{
"path":"https://images.unsplash.com/",
"type":"manifest",
"manifest": [
{
"src":"photo-1542838454-d4dce2a7cfde?fit=crop&w=500&q=60",
"id":"stair_boy",
"type":"image"
},
{
"src":"photo-1549948558-1c6406684186?fit=crop&w=500&q=60",
"id":"night_bridge",
"type":"image"
}
]}
Edit: The type property is only required when there is not a recognizable image extension, such as this case.
From the docs:
The loadManifest call supports four types of manifests:
A string path, which points to a manifest file, which is a JSON file that contains a "manifest" property, which defines the list of files to load, and can optionally contain a "path" property, which will be prepended to each file in the list.
An object which defines a "src", which is a JSON or JSONP file. A "callback" can be defined for JSONP file. The JSON/JSONP file should contain a "manifest" property, which defines the list of files to load, and can optionally contain a "path" property, which will be prepended to each file in the list.
An object which contains a "manifest" property, which defines the list of files to load, and can optionally contain a "path" property, which will be prepended to each file in the list.
An Array of files to load.
Your example uses the first approach. If something is not working, then feel free to post more code.
You could always throw some more events on your queue to see what is happening, such as "fileststart", "fileload", and "error". You should get at least one event when the first manifest starts loading.
Cheers.

JS not loading php into div, website specific behaviour

I have two joomla applications se up with exactly the same versions, the same global configuration settings, and I set up a test application with the following function to load a php into a div on a specific page..
function getDiv(str) {
var id = document.getElementById("appselector").value;
if (id == "") {
document.getElementById("scoffitcategoryedit").innerHTML = "";
return;
}
else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp3 = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp3.onreadystatechange = function() {
if (xmlhttp3.readyState == 4 && xmlhttp3.status == 200) {
document.getElementById("scoffitcategoryedit").innerHTML = xmlhttp3.responseText;
alert("WTF");
}
};
xmlhttp3.open("GET","index.php?option=com_jumi&fileid=23& format=raw&" + str + id, true);
xmlhttp3.send();
}
}
I know its a little long winded, but the problem is that the script works fine in one website, but not in the other. Both of them are loading the same versions of jquery (which as you can see I don't like using), and both have the same templates. The only clue I seem to have found is that when I have text links elsewhere on the site attached with query statements pointing to self (index.php?blastr=bla&drivelstr=drivel), the browser shows index.php/ prepended to the link mentioned above.
I debugged the script and in the non functioning website it hangs on the xmlhttp3.send line.
I know people espouse the beauty of jquery's load() function as a replacement for this, but I cant get it to work (probably because the templates are using jquery versions higher than 1.8.1 when it was deprecated). So i'd rather stick with base js.
Any ideas about this inconsistent behaviour ?
This should be a comment but can't yet :(
I would check your configuration file for this line:
public $live_site = '';
and see if there is something in the failing site besides ''.
I found out what it was, I must have actually installed two different versions of the Jumi application in my websites. one website had a file under components/com_jumi/views/application named view.raw.php while the other did not. This meant that the format=raw in the index.php string could not be interpreted and caused a null response.
I simply copied the file into the other website where it was missing and everything then worked fine. But thanks for the response.

Exception Error: chrome://app/content/app1.js - EXPORTED_SYMBOLS is not an array

"EXPORTED_SYMBOLS is not an array" Exception flagged when tried to use Components.utils.import("chrome://app/content/app1.js");.
I have a XUL application created and from one of the JS File(say app.js) I tried to include the other JS File as shown above.
Both app.js and app1.js are placed in content folder and also in chrome.manifest file following line is added
"content app content/"
In other JS File (app1.js), I have exported symbols like
var EXPORTED_SYMBOLS = ["Fooinstance"];
var Fooinstance = {
foo: function() {
...
}
}
In app.js,
Components.utils.import("chrome://app/content/app1.js");
// Error: chrome://app/content/app1.js - EXPORTED_SYMBOLS is not an array
...
Fooinstance.foo();
I am running this XUL app on XULRunner 17.0.1 win32 libraries.
I looked through the code in this link https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Using
It did not help and if I include it as resource it works however I do not want to include it as part of resource.
Could you someone point out what mistake would be ?
I had this same problem, and I solved it:
1) changing the file extension (.js) by .jsm
2) Adding a first line on your module exporting classes to share. EG:
var EXPORTED_SYMBOLS = ["Xobject"];
function Xobject(){
}
Xobject.prototype.stop = function() {
return 'stop';
}
Xobject.prototype.run = function() {
return 'running';
}
3) Calling this way
Components.utils.import('resource://gre/modules/Services.jsm' );
Components.utils.import("chrome://myFirstAddOn/content/Xobject.jsm");
var myXobject = new Xobject();
alert(myXobject.run());
Hope it help u
For anyone else getting this, another possible reason is a circular dependency. My case was a little different, but I had two JSM files each using Components.utils.import to import each other. Then I got this error in one of them.