Related
I have a [simplified] JSON file like
{
"id":87,
"meta_data":[
{
"id":1232,
"key":"user_created_by",
"value":"example#gmail.com"
},
{
"id":1233,
"key":"user_created_at",
"value":"1659890457477"
},
{
"id":1234,
"key":"good_person_or_silly_sausage",
"value":"No"
}
]
}
I want to do something like
Logger.log(orderDetailsObject.meta_data.value[key="good_person_or_silly_sausage"])
The expected value would be
No
However, this isn't what's occurring. At present I'm being told that the object is null.
I think it's because the meta_data object is an object in an object or two dimensional array or something? I don't have a good understand of what I'm doing here,
I feel like
https://docs.jsonata.org/simple
and
https://docs.jsonata.org/predicate
Should be guiding me towards the answer - but I'm not getting something I think.
I'm a newbie to SO and JSON & Javascript - so please be gentle. <3
EDIT: None-simplified actual json file below:
{
"id":87,
"parent_id":0,
"status":"pending",
"currency":"USD",
"version":"6.5.1",
"prices_include_tax":false,
"date_created":"2022-08-07T16:40:57",
"date_modified":"2022-08-11T10:13:07",
"discount_total":"0.00",
"discount_tax":"0.00",
"shipping_total":"0.00",
"shipping_tax":"0.00",
"cart_tax":"0.00",
"total":"1100.00",
"total_tax":"0.00",
"customer_id":17,
"order_key":"wc_order_omQo7nW5yCS9X",
"billing":{
"first_name":"",
"last_name":"",
"company":"",
"address_1":"",
"address_2":"",
"city":"",
"state":"",
"postcode":"",
"country":"",
"email":"freddie#example.com",
"phone":""
},
"shipping":{
"first_name":"",
"last_name":"",
"company":"",
"address_1":"",
"address_2":"",
"city":"",
"state":"",
"postcode":"",
"country":"",
"phone":""
},
"payment_method":"",
"payment_method_title":"",
"transaction_id":"",
"customer_ip_address":"",
"customer_user_agent":"",
"created_via":"rest-api",
"customer_note":"",
"date_completed":null,
"date_paid":"2022-08-07T16:40:58",
"cart_hash":"",
"number":"87",
"meta_data":[
{
"id":1232,
"key":"user_created_by",
"value":"example#gmail.com"
},
{
"id":1233,
"key":"user_created_at",
"value":"1659890457477"
},
{
"id":1234,
"key":"good_person_or_silly_sausage",
"value":"No"
},
{
"id":1235,
"key":"order_request_high_chair",
"value":"yes"
},
{
"id":1240,
"key":"order_notes",
"value":"They're on their honeymoon"
},
{
"id":1241,
"key":"pricing_notes",
"value":"They're on their honeymoon"
},
{
"id":1242,
"key":"order_booked_by",
"value":"me on me"
},
{
"id":1243,
"key":"order_referral_source",
"value":"Newspaper"
},
{
"id":1244,
"key":"commission_percent",
"value":"13"
},
{
"id":1245,
"key":"discount_percent",
"value":"5"
},
{
"id":1246,
"key":"deposit_paid_date",
"value":"today"
},
{
"id":1247,
"key":"damage_bond_date_paid",
"value":"today"
},
{
"id":1248,
"key":"damage_bond",
"value":"100"
},
{
"id":1249,
"key":"start_date",
"value":"01\/01\/01"
},
{
"id":1250,
"key":"deposit_payment_amount",
"value":"500"
},
{
"id":1251,
"key":"order_request_welcome_pack_wine_type",
"value":"Red"
},
{
"id":1252,
"key":"end_date",
"value":"02\/02\/02"
},
{
"id":1259,
"key":"_new_order_email_sent",
"value":"true"
},
{
"id":1260,
"key":"_automatewoo_order_created",
"value":"1"
}
],
"line_items":[
{
"id":45,
"name":"Villa Booking",
"product_id":0,
"variation_id":0,
"quantity":1,
"tax_class":"",
"subtotal":"1000.00",
"subtotal_tax":"0.00",
"total":"1000.00",
"total_tax":"0.00",
"taxes":[
],
"meta_data":[
{
"id":411,
"key":"Dates",
"value":"01\/01\/01 until 02\/02\/02",
"display_key":"Dates",
"display_value":"01\/01\/01 until 02\/02\/02"
}
],
"sku":null,
"price":1000,
"parent_name":null
},
{
"id":46,
"name":"Standard Welcome Pack",
"product_id":73,
"variation_id":0,
"quantity":2,
"tax_class":"",
"subtotal":"0.00",
"subtotal_tax":"0.00",
"total":"0.00",
"total_tax":"0.00",
"taxes":[
],
"meta_data":[
{
"id":421,
"key":"Wine Type",
"value":"Red",
"display_key":"Wine Type",
"display_value":"Red"
}
],
"sku":"",
"price":0,
"parent_name":null
}
],
"tax_lines":[
],
"shipping_lines":[
],
"fee_lines":[
{
"id":47,
"name":"Damage Bond",
"tax_class":"",
"tax_status":"taxable",
"amount":"100",
"total":"100.00",
"total_tax":"0.00",
"taxes":[
],
"meta_data":[
{
"id":428,
"key":"damage_bond_paid_to",
"value":"example#gmail.com",
"display_key":"damage_bond_paid_to",
"display_value":"example#gmail.com"
},
{
"id":429,
"key":"damage_bond_paid_on",
"value":"today",
"display_key":"damage_bond_paid_on",
"display_value":"today"
}
]
},
{
"id":48,
"name":"Booking Fee",
"tax_class":"",
"tax_status":"taxable",
"amount":"",
"total":"0.00",
"total_tax":"0.00",
"taxes":[
],
"meta_data":[
{
"id":436,
"key":"dbooing_fee_paid_to",
"value":"example#gmail.com",
"display_key":"dbooing_fee_paid_to",
"display_value":"example#gmail.com"
},
{
"id":437,
"key":"booking_fee_paid_on",
"value":"1659890457477",
"display_key":"booking_fee_paid_on",
"display_value":"1659890457477"
}
]
}
],
"coupon_lines":[
],
"refunds":[
],
"payment_url":"https:\/\/dev1.example.com\/checkout\/order-pay\/87\/?pay_for_order=true&key=wc_order_omQo7nW5yCS9X",
"date_created_gmt":"2022-08-07T16:40:57",
"date_modified_gmt":"2022-08-11T10:13:07",
"date_completed_gmt":null,
"date_paid_gmt":"2022-08-07T16:40:58",
"currency_symbol":"$",
"_links":{
"self":[
{
"href":"https:\/\/dev1.example.com\/wp-json\/wc\/v3\/orders\/87"
}
],
"collection":[
{
"href":"https:\/\/dev1.example.com\/wp-json\/wc\/v3\/orders"
}
],
"customer":[
{
"href":"https:\/\/dev1.example.com\/wp-json\/wc\/v3\/customers\/17"
}
]
}
}
You can use the find method on the array:
const orderDetailsObject = {"id":87,"meta_data":[{"id":1232,"key":"user_created_by","value":"example#gmail.com"},{"id":1233,"key":"user_created_at","value":"1659890457477"},{"id":1234,"key":"good_person_or_silly_sausage","value":"No"}]};
console.log(orderDetailsObject.meta_data.find(
({key}) => key == "good_person_or_silly_sausage"
)?.value);
I'm trying to filter a data only "$match" user_data && seat_id I want use array that get in first "$match" in last pipeline "$match" after "$unwind" operator and I'm trying to do "$lookup" and find only matching element. my last "$match" aggregate not working last pipeline is to not working
---------this is my data----------
{
"user_id": {
"$oid": "62b048e762c6edd8b5d55b3e"
},
"ticketData": [
{
"seat_id": {
"$oid": "62b2098a9d03eb2e90ec089f"
}
},
{
"seat_id": {
"$oid": "62b2098a9d03eb2e90ec08a0"
}
},
{
"seat_id": {
"$oid": "62b2098a9d03eb2e90ec08a1"
}
}
],
"seat_status": true,
"createdAt": {
"$date": "2022-06-22T05:19:40.995Z"
}
}
this is the pipeline that I wrote
[
{
'$match': {
'user_id': new ObjectId('62b048e762c6edd8b5d55b3e')
}
}, {
'$lookup': {
'from': 'seats',
'localField': 'ticketData.seat_id',
'foreignField': 'show_seats.showByDate.shows.showSeats._id',
'as': 'seat_details'
}
}, {
'$unwind': {
'path': '$seat_details'
}
}, {
'$unwind': {
'path': '$seat_details.show_seats'
}
}, {
'$unwind': {
'path': '$seat_details.show_seats.showByDate.shows'
}
}, {
'$unwind': {
'path': '$seat_details.show_seats.showByDate.shows.showSeats'
}
}, {
'$match': {
'seat_details.show_seats.showByDate.shows.showSeats._id': {
'$in': 'ticketData.seat_id'
}
}
}
]
So, I'm relatively new to javascript, and I'm working with a client-side javascript function that inserts JSON results pushed to it from the server.
I would like to stop certain results, independently of that javascript that populating the results.
Usually, if the js was my own, I'd make a guess that I'd use the "splice" function to remove the JSON array entry(ies) that I don't wish to be there, does that sound about right? (I'd got to there through plenty of searching on StartPage and here)
However, I need whatever function I (let's be honest, "you") come up with to trump the embedded results.
Essentially this is normal behaviour:
Webpage > JavaScript Parses JSON for Initial Results
then
Webpage > Scroll > JavaScript Parses JSON for More Results
I'd like to insert something that will stop any JSON items that I don't like. I don't know how to represent that, I'd assume:
Worker in Extension/Add-On > Webpage > etc
I doubt this can be done with CSS ... but that'd be awesome, as I'd just put it in my personal.
If it was splice, I'd have a vague idea (but really I'm flying blind) of how to do it on a base level with splice, but I'm already struggling, and that would deepen for the insanely deeply embedded objects I'm trying to exclude.
So. There is lot of json data in the section I'm looking at.
I'm purely concentrated on the removing of the array here, but by end goal is two parts:
In the ' contents ' array in levelOneB's ' daContentShaper ' I would
like to remove any item from the array where in the sub-object '
content ' there is an element called ' contentTypeA '. There's another
object with the label ' ahThisIsTheBContent ', which I'd also like gone,
and that's dotted through the JSON. All other items (TypeB, TypeC, or
other) must stay.
Additionally, within said ' content ' object I would like to change any ' visible ' values that are " false " to " true ".
It's definitely possible, it's just working out how to ensure that the rest of the code (which may have similar - not the same - parts elsewhere) isn't affected by my splice of this array.
{
"levelOneA": {
"levelOneAArr": [ { "name": "me", "age": 1 }, { "name": "you", "age": 2 }, { "name": "them", "age": 3 } ],
"levelOneAText": "blah"
},
"levelOneB": {
"levelOneBDeepBro": {
"levelOneBDeepBroTabs": [
{
"levelOneBDeepBroTabsShaper": {
"isBlessed": true,
"daContent": {
"daContentShaper": {
"contents": [
{
"contentItem": {
"content": {
"contentTypeA": {
"bitA": "bitAText",
"bitB": [
{
"bitBText1": "cripes"
},
{
"bitBText1": "crikey"
},
{
"bitBText1": "crimeny"
}
],
"visible": true
}
},
"extraNonsense": "bingoBlah"
}
},
{
"contentItem": {
"content": {
"ahThisIsTheBContent": {
"bitA": "bitAText",
"bitB": [
{
"bitBText1": "cripes"
},
{
"bitBText1": "crikey"
},
{
"bitBText1": "crimeny"
}
],
"visible": false
}
},
"extraNonsense": "bingoBlahBlah"
}
},
{
"contentItem": {
"content": {
"contentTypeB": {
"bitA": "bitAText",
"bitB": [
{
"bitBText1": "jinkies"
},
{
"bitBText1": "ruh roh"
},
{
"bitBText1": "like, wow"
}
],
"visible": true
}
},
"extraNonsense": "bingoBlahBlah"
}
},
{
"contentItem": {
"content": {
"contentTypeC": {
"bitA": "bitAText",
"bitB": [
{
"bitBText1": "cripes"
},
{
"bitBText1": "crikey"
},
{
"bitBText1": "crimeny"
}
],
"visible": true
}
},
"extraNonsense": "bingoBlahBlahBlah"
}
}
],
"myDadIsBetter": "Go Faster Stripes, innit."
}
},
"tabId": "Bro"
}
}
]
}
},
"levelOneC": "CAAQhGciEwi0iqD5-ZbwAhUBPvEFHQMKAeo=",
"levelOneD": {
"iAmJustHappyToBeNominated": "innit",
"damnYourWholePopCultureSubsection": "flames abound"
}
}
This is how you could solve this using object-scan
Note that I used quite a few ** in the matching. You could write these out exactly, it depends on your requirement
// const objectScan = require('object-scan');
const data = { levelOneA: { levelOneAArr: [{ name: 'me', age: 1 }, { name: 'you', age: 2 }, { name: 'them', age: 3 }], levelOneAText: 'blah' }, levelOneB: { levelOneBDeepBro: { levelOneBDeepBroTabs: [ { levelOneBDeepBroTabsShaper: { isBlessed: true, daContent: { daContentShaper: { contents: [ { contentItem: { content: { contentTypeA: { bitA: 'bitAText', bitB: [ { bitBText1: 'cripes' }, { bitBText1: 'crikey' }, { bitBText1: 'crimeny' } ], visible: true } }, extraNonsense: 'bingoBlah' } }, { contentItem: { content: { ahThisIsTheBContent: { bitA: 'bitAText', bitB: [ { bitBText1: 'cripes' }, { bitBText1: 'crikey' }, { bitBText1: 'crimeny' } ], visible: false } }, extraNonsense: 'bingoBlahBlah' } }, { contentItem: { content: { contentTypeB: { bitA: 'bitAText', bitB: [ { bitBText1: 'jinkies' }, { bitBText1: 'ruh roh' }, { bitBText1: 'like, wow' } ], visible: false } }, extraNonsense: 'bingoBlahBlah' } }, { contentItem: { content: { contentTypeC: { bitA: 'bitAText', bitB: [ { bitBText1: 'cripes' }, { bitBText1: 'crikey' }, { bitBText1: 'crimeny' } ], visible: false } }, extraNonsense: 'bingoBlahBlahBlah' } } ], myDadIsBetter: 'Go Faster Stripes, innit.' } }, tabId: 'Bro' } } ] } }, levelOneC: 'CAAQhGciEwi0iqD5-ZbwAhUBPvEFHQMKAeo=', levelOneD: { iAmJustHappyToBeNominated: 'innit', damnYourWholePopCultureSubsection: 'flames abound' } };
const logic = {
'levelOneB.**.daContentShaper.contents[*].*.content.{contentTypeA,ahThisIsTheBContent}': ({ key, parents }) => {
parents[3].splice(key[key.length - 4], 1);
},
'levelOneB.**.daContentShaper.contents.**.visible': ({ value, parent, property }) => {
if (value === false) {
parent[property] = true;
}
}
};
const modify = objectScan(Object.keys(logic), {
rtn: 'count',
filterFn: ({ matchedBy, property, key, value, parent, parents }) => {
matchedBy.forEach((m) => logic[m]({ property, key, value, parent, parents }));
}
});
console.log(modify(data));
// => 6
console.log(data);
// => { levelOneA: { levelOneAArr: [ { name: 'me', age: 1 }, { name: 'you', age: 2 }, { name: 'them', age: 3 } ], levelOneAText: 'blah' }, levelOneB: { levelOneBDeepBro: { levelOneBDeepBroTabs: [ { levelOneBDeepBroTabsShaper: { isBlessed: true, daContent: { daContentShaper: { contents: [ { contentItem: { content: { contentTypeB: { bitA: 'bitAText', bitB: [ { bitBText1: 'jinkies' }, { bitBText1: 'ruh roh' }, { bitBText1: 'like, wow' } ], visible: true } }, extraNonsense: 'bingoBlahBlah' } }, { contentItem: { content: { contentTypeC: { bitA: 'bitAText', bitB: [ { bitBText1: 'cripes' }, { bitBText1: 'crikey' }, { bitBText1: 'crimeny' } ], visible: true } }, extraNonsense: 'bingoBlahBlahBlah' } } ], myDadIsBetter: 'Go Faster Stripes, innit.' } }, tabId: 'Bro' } } ] } }, levelOneC: 'CAAQhGciEwi0iqD5-ZbwAhUBPvEFHQMKAeo=', levelOneD: { iAmJustHappyToBeNominated: 'innit', damnYourWholePopCultureSubsection: 'flames abound' } }
.as-console-wrapper {max-height: 100% !important; top: 0}
<script src="https://bundle.run/object-scan#14.3.0"></script>
Disclaimer: I'm the author of object-scan
here i am pasting my code at below, please guide me how i can click on the link from dropouts..
let showWomenCategoryMenuDropout = false;
class WomenCategoryMenu extends React.Component {
constructor(props) {
super(props);
this.state = {
showWomenCategoryMenuDropout: false
};
this.openWomenCategoryMenuDropout = this.openWomenCategoryMenuDropout.bind(
this
);
this.closeWomenCategoryMenuDropout = this.closeWomenCategoryMenuDropout.bind(
this
);
}
openWomenCategoryMenuDropout() {
this.setState({
showWomenCategoryMenuDropout: true
});
}
closeWomenCategoryMenuDropout() {
this.setState({
showWomenCategoryMenuDropout: false
});
}
render() {
return (
<div>
<div
className={classnames(style.header_category_menu_container)}
onMouseOut={this.closeWomenCategoryMenuDropout}
onMouseEnter={this.openWomenCategoryMenuDropout}>
<span>Women</span>
</div>
<div>
<SignIn
type="dropout"
open={this.state.showWomenCategoryMenuDropout}
onMouseOut={this.closeWomenCategoryMenuDropout}
onMouseEnter={this.openWomenCategoryMenuDropout}>
<div className={classnames(style.cartegory_wrapper)}>
<CategoryGrid>
{data.map((ele, index) => (
<div
className={classnames(style.cartegory_menu)}
key={"Key-" + index}>
<h3 className={classnames(style.cartegory_menu_title)}>
{ele.categorytitle}
</h3>
<ul>
{Array.isArray(ele.category) &&
ele.category.map((d, i) => (
<li key={"Key-" + i}>{d[`Category${i + 1}`]}</li>
))}
{ele.imagePath && <img src={ele.imagePath} />}
</ul>
</div>
))}
</CategoryGrid>
</div>
</SignIn>
</div>
</div>
);
}
}
also please find the JASON data at below...
var data = [
{
categorytitle: "Shoes",
category: [
{
Category1: "Boots"
},
{
Category2: "Sneakers"
},
{
Category3: "Flats"
},
{
Category4: "Booties"
},
{
Category5: "Mules"
},
{
Category6: "Heels/Pumps"
},
{
Category7: "Clogs"
},
{
Category8: "Slippers"
},
{
Category9: "Sandals"
},
{
Category10: "Sale"
},
{
Category11: "Shop All"
}
]
},
{
categorytitle: "Activities",
category: [
{
Category1: "Comfort Shop"
},
{
Category2: "Run Shop"
},
{
Category3: "Trend Guide"
},
{
Category4: "Athletic"
},
{
Category5: "Casual"
},
{
Category6: "Dress"
},
{
Category7: "Outdoor"
},
{
Category8: "Walking"
},
{
Category9: "Foot Health & Wellness"
},
{
Category10: "Narrow Shoes"
},
{
Category11: "Wide Shoes"
}
]
},
{
categorytitle: "Clothing & More",
category: [
{
Category1: "Handbags/Purses"
},
{
Category2: "Active & Yoga"
},
{
Category3: "Coats & Jackets"
},
{
Category4: "Athletic"
},
{
Category5: "Dresses"
},
{
Category6: "Tops"
},
{
Category7: "Sweaters"
},
{
Category8: "Socks"
},
{
Category9: "Sunglasses"
},
{
Category10: "Rain Gear"
},
{
Category11: "Wide Shoes"
}
]
},
{
categorytitle: "Top Brands",
category: [
{
Category1: "Sam Edelman"
},
{
Category2: "Clarks"
},
{
Category3: "Dr Martens"
},
{
Category4: "Lucky Brand"
},
{
Category5: "New Balance"
},
{
Category6: "Skechers"
},
{
Category7: "Sperry Top-Sider"
},
{
Category8: "Sorel"
},
{
Category9: "TOMS"
},
{
Category10: "UGG"
},
{
Category11: "Vionic"
}
]
},
{
targetUrl: "/",
imagePath:
"src/image1",
title: "WORK SHOP"
}
];
this above is my JSON data, here once mouse hover dropuout is showing correctly but once i am going to click any link from dropout the dropouts itself is closing.
This problem got solved ..here just need to replace from onMouseOut to onMouseLeave.
This question already has answers here:
Language name from ISO 639-1 code in Javascript
(7 answers)
Closed 9 years ago.
I know that I can get the language code via navigator.language but is it possible to get the language name rather than language code.
My expected result can be a string of "Russian" or "Русский". Both are fine to me.
Thanks,
Here's a function that gets the name
function getLang(code) {
var lang = code || navigator.language,
codes = {
"ab":{
"name":"Abkhaz",
"nativeName":"аҧсуа"
},
"aa":{
"name":"Afar",
"nativeName":"Afaraf"
},
"af":{
"name":"Afrikaans",
"nativeName":"Afrikaans"
},
"ak":{
"name":"Akan",
"nativeName":"Akan"
},
"sq":{
"name":"Albanian",
"nativeName":"Shqip"
},
"am":{
"name":"Amharic",
"nativeName":"አማርኛ"
},
"ar":{
"name":"Arabic",
"nativeName":"العربية"
},
"an":{
"name":"Aragonese",
"nativeName":"Aragonés"
},
"hy":{
"name":"Armenian",
"nativeName":"Հայերեն"
},
"as":{
"name":"Assamese",
"nativeName":"অসমীয়া"
},
"av":{
"name":"Avaric",
"nativeName":"авар мацӀ, магӀарул мацӀ"
},
"ae":{
"name":"Avestan",
"nativeName":"avesta"
},
"ay":{
"name":"Aymara",
"nativeName":"aymar aru"
},
"az":{
"name":"Azerbaijani",
"nativeName":"azərbaycan dili"
},
"bm":{
"name":"Bambara",
"nativeName":"bamanankan"
},
"ba":{
"name":"Bashkir",
"nativeName":"башҡорт теле"
},
"eu":{
"name":"Basque",
"nativeName":"euskara, euskera"
},
"be":{
"name":"Belarusian",
"nativeName":"Беларуская"
},
"bn":{
"name":"Bengali",
"nativeName":"বাংলা"
},
"bh":{
"name":"Bihari",
"nativeName":"भोजपुरी"
},
"bi":{
"name":"Bislama",
"nativeName":"Bislama"
},
"bs":{
"name":"Bosnian",
"nativeName":"bosanski jezik"
},
"br":{
"name":"Breton",
"nativeName":"brezhoneg"
},
"bg":{
"name":"Bulgarian",
"nativeName":"български език"
},
"my":{
"name":"Burmese",
"nativeName":"ဗမာစာ"
},
"ca":{
"name":"Catalan; Valencian",
"nativeName":"Català"
},
"ch":{
"name":"Chamorro",
"nativeName":"Chamoru"
},
"ce":{
"name":"Chechen",
"nativeName":"нохчийн мотт"
},
"ny":{
"name":"Chichewa; Chewa; Nyanja",
"nativeName":"chiCheŵa, chinyanja"
},
"zh":{
"name":"Chinese",
"nativeName":"中文 (Zhōngwén), 汉语, 漢語"
},
"cv":{
"name":"Chuvash",
"nativeName":"чӑваш чӗлхи"
},
"kw":{
"name":"Cornish",
"nativeName":"Kernewek"
},
"co":{
"name":"Corsican",
"nativeName":"corsu, lingua corsa"
},
"cr":{
"name":"Cree",
"nativeName":"ᓀᐦᐃᔭᐍᐏᐣ"
},
"hr":{
"name":"Croatian",
"nativeName":"hrvatski"
},
"cs":{
"name":"Czech",
"nativeName":"česky, čeština"
},
"da":{
"name":"Danish",
"nativeName":"dansk"
},
"dv":{
"name":"Divehi; Dhivehi; Maldivian;",
"nativeName":"ދިވެހި"
},
"nl":{
"name":"Dutch",
"nativeName":"Nederlands, Vlaams"
},
"en":{
"name":"English",
"nativeName":"English"
},
"eo":{
"name":"Esperanto",
"nativeName":"Esperanto"
},
"et":{
"name":"Estonian",
"nativeName":"eesti, eesti keel"
},
"ee":{
"name":"Ewe",
"nativeName":"Eʋegbe"
},
"fo":{
"name":"Faroese",
"nativeName":"føroyskt"
},
"fj":{
"name":"Fijian",
"nativeName":"vosa Vakaviti"
},
"fi":{
"name":"Finnish",
"nativeName":"suomi, suomen kieli"
},
"fr":{
"name":"French",
"nativeName":"français, langue française"
},
"ff":{
"name":"Fula; Fulah; Pulaar; Pular",
"nativeName":"Fulfulde, Pulaar, Pular"
},
"gl":{
"name":"Galician",
"nativeName":"Galego"
},
"ka":{
"name":"Georgian",
"nativeName":"ქართული"
},
"de":{
"name":"German",
"nativeName":"Deutsch"
},
"el":{
"name":"Greek, Modern",
"nativeName":"Ελληνικά"
},
"gn":{
"name":"Guaraní",
"nativeName":"Avañeẽ"
},
"gu":{
"name":"Gujarati",
"nativeName":"ગુજરાતી"
},
"ht":{
"name":"Haitian; Haitian Creole",
"nativeName":"Kreyòl ayisyen"
},
"ha":{
"name":"Hausa",
"nativeName":"Hausa, هَوُسَ"
},
"he":{
"name":"Hebrew (modern)",
"nativeName":"עברית"
},
"hz":{
"name":"Herero",
"nativeName":"Otjiherero"
},
"hi":{
"name":"Hindi",
"nativeName":"हिन्दी, हिंदी"
},
"ho":{
"name":"Hiri Motu",
"nativeName":"Hiri Motu"
},
"hu":{
"name":"Hungarian",
"nativeName":"Magyar"
},
"ia":{
"name":"Interlingua",
"nativeName":"Interlingua"
},
"id":{
"name":"Indonesian",
"nativeName":"Bahasa Indonesia"
},
"ie":{
"name":"Interlingue",
"nativeName":"Originally called Occidental; then Interlingue after WWII"
},
"ga":{
"name":"Irish",
"nativeName":"Gaeilge"
},
"ig":{
"name":"Igbo",
"nativeName":"Asụsụ Igbo"
},
"ik":{
"name":"Inupiaq",
"nativeName":"Iñupiaq, Iñupiatun"
},
"io":{
"name":"Ido",
"nativeName":"Ido"
},
"is":{
"name":"Icelandic",
"nativeName":"Íslenska"
},
"it":{
"name":"Italian",
"nativeName":"Italiano"
},
"iu":{
"name":"Inuktitut",
"nativeName":"ᐃᓄᒃᑎᑐᑦ"
},
"ja":{
"name":"Japanese",
"nativeName":"日本語 (にほんご/にっぽんご)"
},
"jv":{
"name":"Javanese",
"nativeName":"basa Jawa"
},
"kl":{
"name":"Kalaallisut, Greenlandic",
"nativeName":"kalaallisut, kalaallit oqaasii"
},
"kn":{
"name":"Kannada",
"nativeName":"ಕನ್ನಡ"
},
"kr":{
"name":"Kanuri",
"nativeName":"Kanuri"
},
"ks":{
"name":"Kashmiri",
"nativeName":"कश्मीरी, كشميري"
},
"kk":{
"name":"Kazakh",
"nativeName":"Қазақ тілі"
},
"km":{
"name":"Khmer",
"nativeName":"ភាសាខ្មែរ"
},
"ki":{
"name":"Kikuyu, Gikuyu",
"nativeName":"Gĩkũyũ"
},
"rw":{
"name":"Kinyarwanda",
"nativeName":"Ikinyarwanda"
},
"ky":{
"name":"Kirghiz, Kyrgyz",
"nativeName":"кыргыз тили"
},
"kv":{
"name":"Komi",
"nativeName":"коми кыв"
},
"kg":{
"name":"Kongo",
"nativeName":"KiKongo"
},
"ko":{
"name":"Korean",
"nativeName":"한국어 (韓國語), 조선말 (朝鮮語)"
},
"ku":{
"name":"Kurdish",
"nativeName":"Kurdî, كوردی"
},
"kj":{
"name":"Kwanyama, Kuanyama",
"nativeName":"Kuanyama"
},
"la":{
"name":"Latin",
"nativeName":"latine, lingua latina"
},
"lb":{
"name":"Luxembourgish, Letzeburgesch",
"nativeName":"Lëtzebuergesch"
},
"lg":{
"name":"Luganda",
"nativeName":"Luganda"
},
"li":{
"name":"Limburgish, Limburgan, Limburger",
"nativeName":"Limburgs"
},
"ln":{
"name":"Lingala",
"nativeName":"Lingála"
},
"lo":{
"name":"Lao",
"nativeName":"ພາສາລາວ"
},
"lt":{
"name":"Lithuanian",
"nativeName":"lietuvių kalba"
},
"lu":{
"name":"Luba-Katanga",
"nativeName":""
},
"lv":{
"name":"Latvian",
"nativeName":"latviešu valoda"
},
"gv":{
"name":"Manx",
"nativeName":"Gaelg, Gailck"
},
"mk":{
"name":"Macedonian",
"nativeName":"македонски јазик"
},
"mg":{
"name":"Malagasy",
"nativeName":"Malagasy fiteny"
},
"ms":{
"name":"Malay",
"nativeName":"bahasa Melayu, بهاس ملايو"
},
"ml":{
"name":"Malayalam",
"nativeName":"മലയാളം"
},
"mt":{
"name":"Maltese",
"nativeName":"Malti"
},
"mi":{
"name":"Māori",
"nativeName":"te reo Māori"
},
"mr":{
"name":"Marathi (Marāṭhī)",
"nativeName":"मराठी"
},
"mh":{
"name":"Marshallese",
"nativeName":"Kajin M̧ajeļ"
},
"mn":{
"name":"Mongolian",
"nativeName":"монгол"
},
"na":{
"name":"Nauru",
"nativeName":"Ekakairũ Naoero"
},
"nv":{
"name":"Navajo, Navaho",
"nativeName":"Diné bizaad, Dinékʼehǰí"
},
"nb":{
"name":"Norwegian Bokmål",
"nativeName":"Norsk bokmål"
},
"nd":{
"name":"North Ndebele",
"nativeName":"isiNdebele"
},
"ne":{
"name":"Nepali",
"nativeName":"नेपाली"
},
"ng":{
"name":"Ndonga",
"nativeName":"Owambo"
},
"nn":{
"name":"Norwegian Nynorsk",
"nativeName":"Norsk nynorsk"
},
"no":{
"name":"Norwegian",
"nativeName":"Norsk"
},
"ii":{
"name":"Nuosu",
"nativeName":"ꆈꌠ꒿ Nuosuhxop"
},
"nr":{
"name":"South Ndebele",
"nativeName":"isiNdebele"
},
"oc":{
"name":"Occitan",
"nativeName":"Occitan"
},
"oj":{
"name":"Ojibwe, Ojibwa",
"nativeName":"ᐊᓂᔑᓈᐯᒧᐎᓐ"
},
"cu":{
"name":"Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic",
"nativeName":"ѩзыкъ словѣньскъ"
},
"om":{
"name":"Oromo",
"nativeName":"Afaan Oromoo"
},
"or":{
"name":"Oriya",
"nativeName":"ଓଡ଼ିଆ"
},
"os":{
"name":"Ossetian, Ossetic",
"nativeName":"ирон æвзаг"
},
"pa":{
"name":"Panjabi, Punjabi",
"nativeName":"ਪੰਜਾਬੀ, پنجابی"
},
"pi":{
"name":"Pāli",
"nativeName":"पाऴि"
},
"fa":{
"name":"Persian",
"nativeName":"فارسی"
},
"pl":{
"name":"Polish",
"nativeName":"polski"
},
"ps":{
"name":"Pashto, Pushto",
"nativeName":"پښتو"
},
"pt":{
"name":"Portuguese",
"nativeName":"Português"
},
"qu":{
"name":"Quechua",
"nativeName":"Runa Simi, Kichwa"
},
"rm":{
"name":"Romansh",
"nativeName":"rumantsch grischun"
},
"rn":{
"name":"Kirundi",
"nativeName":"kiRundi"
},
"ro":{
"name":"Romanian, Moldavian, Moldovan",
"nativeName":"română"
},
"ru":{
"name":"Russian",
"nativeName":"русский язык"
},
"sa":{
"name":"Sanskrit (Saṁskṛta)",
"nativeName":"संस्कृतम्"
},
"sc":{
"name":"Sardinian",
"nativeName":"sardu"
},
"sd":{
"name":"Sindhi",
"nativeName":"सिन्धी, سنڌي، سندھی"
},
"se":{
"name":"Northern Sami",
"nativeName":"Davvisámegiella"
},
"sm":{
"name":"Samoan",
"nativeName":"gagana faa Samoa"
},
"sg":{
"name":"Sango",
"nativeName":"yângâ tî sängö"
},
"sr":{
"name":"Serbian",
"nativeName":"српски језик"
},
"gd":{
"name":"Scottish Gaelic; Gaelic",
"nativeName":"Gàidhlig"
},
"sn":{
"name":"Shona",
"nativeName":"chiShona"
},
"si":{
"name":"Sinhala, Sinhalese",
"nativeName":"සිංහල"
},
"sk":{
"name":"Slovak",
"nativeName":"slovenčina"
},
"sl":{
"name":"Slovene",
"nativeName":"slovenščina"
},
"so":{
"name":"Somali",
"nativeName":"Soomaaliga, af Soomaali"
},
"st":{
"name":"Southern Sotho",
"nativeName":"Sesotho"
},
"es":{
"name":"Spanish; Castilian",
"nativeName":"español, castellano"
},
"su":{
"name":"Sundanese",
"nativeName":"Basa Sunda"
},
"sw":{
"name":"Swahili",
"nativeName":"Kiswahili"
},
"ss":{
"name":"Swati",
"nativeName":"SiSwati"
},
"sv":{
"name":"Swedish",
"nativeName":"svenska"
},
"ta":{
"name":"Tamil",
"nativeName":"தமிழ்"
},
"te":{
"name":"Telugu",
"nativeName":"తెలుగు"
},
"tg":{
"name":"Tajik",
"nativeName":"тоҷикӣ, toğikī, تاجیکی"
},
"th":{
"name":"Thai",
"nativeName":"ไทย"
},
"ti":{
"name":"Tigrinya",
"nativeName":"ትግርኛ"
},
"bo":{
"name":"Tibetan Standard, Tibetan, Central",
"nativeName":"བོད་ཡིག"
},
"tk":{
"name":"Turkmen",
"nativeName":"Türkmen, Түркмен"
},
"tl":{
"name":"Tagalog",
"nativeName":"Wikang Tagalog, ᜏᜒᜃᜅ᜔ ᜆᜄᜎᜓᜄ᜔"
},
"tn":{
"name":"Tswana",
"nativeName":"Setswana"
},
"to":{
"name":"Tonga (Tonga Islands)",
"nativeName":"faka Tonga"
},
"tr":{
"name":"Turkish",
"nativeName":"Türkçe"
},
"ts":{
"name":"Tsonga",
"nativeName":"Xitsonga"
},
"tt":{
"name":"Tatar",
"nativeName":"татарча, tatarça, تاتارچا"
},
"tw":{
"name":"Twi",
"nativeName":"Twi"
},
"ty":{
"name":"Tahitian",
"nativeName":"Reo Tahiti"
},
"ug":{
"name":"Uighur, Uyghur",
"nativeName":"Uyƣurqə, ئۇيغۇرچە"
},
"uk":{
"name":"Ukrainian",
"nativeName":"українська"
},
"ur":{
"name":"Urdu",
"nativeName":"اردو"
},
"uz":{
"name":"Uzbek",
"nativeName":"zbek, Ўзбек, أۇزبېك"
},
"ve":{
"name":"Venda",
"nativeName":"Tshivenḓa"
},
"vi":{
"name":"Vietnamese",
"nativeName":"Tiếng Việt"
},
"vo":{
"name":"Volapük",
"nativeName":"Volapük"
},
"wa":{
"name":"Walloon",
"nativeName":"Walon"
},
"cy":{
"name":"Welsh",
"nativeName":"Cymraeg"
},
"wo":{
"name":"Wolof",
"nativeName":"Wollof"
},
"fy":{
"name":"Western Frisian",
"nativeName":"Frysk"
},
"xh":{
"name":"Xhosa",
"nativeName":"isiXhosa"
},
"yi":{
"name":"Yiddish",
"nativeName":"ייִדיש"
},
"yo":{
"name":"Yoruba",
"nativeName":"Yorùbá"
},
"za":{
"name":"Zhuang, Chuang",
"nativeName":"Saɯ cueŋƅ, Saw cuengh"
}
}
return codes[lang];
}
FIDDLE