Skip to content

Instantly share code, notes, and snippets.

@opyh
Forked from mutaphysis/translatelinks.js
Last active November 6, 2018 12:54
Show Gist options
  • Save opyh/fdfc61dde03d13d03b2722d92b7a2dbd to your computer and use it in GitHub Desktop.
Save opyh/fdfc61dde03d13d03b2722d92b7a2dbd to your computer and use it in GitHub Desktop.
Link Translation snippet
function makeid() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < 13; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
var links = [
{
"order": 0,
"label": {
"ar": "دليل السفر",
"bg": "Пътеводител",
"ca": "Guia de viatge",
"cs": "Průvodce",
"da": "Rejseguide",
"de": "Reiseführer",
"el": "Ταξιδιωτικός οδηγός",
"es": "Guía turística",
"fi": "Matkaopas",
"fr": "Guide de voyage",
"he": "מדריך נסיעה",
"hu": "Útikalauz",
"it": "Guida viaggi",
"ja": "旅行ガイド",
"ko": "여행 가이드",
"mn": "Аялалын хөтөч",
"nl": "Reisgids",
"no": "Reiseguide",
"pl": "Przewodnik turystyczny",
"pt": "Guia de viagens",
"ro": "Ghid turistic",
"ru": "Путеводитель",
"sk": "Cestovný sprievodca",
"sv": "Reseguide",
"tr": "Gezi rehberi",
"zh_TW": "旅行指南"
},
"url": {
"en_US": "https://travelable.info/"
}
},
{
"order": 1,
"label": {
"ar": "شارك في العمل",
"bg": "Включете се",
"ca": "Involucrar-se",
"cs": "Zapojte se",
"da": "Bliv involveret",
"de": "Mitmachen",
"el": "Συμμετέχετε",
"es": "Participar",
"fi": "Osallistu",
"fr": "S'impliquer",
"he": "להתערב",
"hu": "Vegyél részt",
"it": "Partecipa",
"ja": "参加しましょう",
"ko": "참여하기",
"mn": "Оруулах ",
"nl": "Doe mee",
"no": "Bli involvert",
"pl": "Zaangażuj się",
"pt": "Envolva-se",
"ro": "Implică-te",
"ru": "Поучаствуйте",
"sk": "Zapojte sa",
"sv": "Bli delaktig",
"tr": "Siz de katılın",
"zh_TW": "參與其中"
},
"url": {
"en_US": "https://news.wheelmap.org/en/wheelmap-ambassador/",
"de_DE": "https://news.wheelmap.org/wheelmap-ambassador/"
}
},
{
"order": 2,
"label": {
"ar": "أخبار",
"bg": "Новини",
"ca": "Noticies",
"cs": "Zprávy",
"da": "Nyheder",
"el": "Ειδήσεις",
"es": "Noticias",
"fi": "Uutiset",
"fr": "Nouvelles",
"he": "חדשות",
"hu": "Hírek",
"it": "Notizie",
"ja": "ニュース",
"ko": "뉴스",
"mn": "Мэдээ",
"nl": "Nieuws",
"no": "Nyheter",
"pl": "Aktualności",
"pt": "Novidades",
"ro": "Ştiri",
"ru": "Новости",
"sk": "Novinky",
"sv": "Nyheter",
"tr": "Haberler",
"zh_TW": "新消息"
},
"url": {
"en_US": "https://news.wheelmap.org/en/#news",
"de_DE": "https://news.wheelmap.org/#news"
}
},
{
"order": 3,
"label": {
"ar": "تعليقات صحفية",
"bg": "Преса",
"ca": "Premsa",
"cs": "Tisk",
"da": "Presse",
"de": "Presse",
"el": "Τύπος",
"es": "Prensa",
"fi": "Media",
"fr": "Presse",
"he": "לחץ",
"hu": "Sajtó",
"it": "Stampa",
"ja": "押す",
"ko": "보도자료",
"mn": "Хэвлэх",
"nl": "Pers",
"no": "Presse",
"pl": "Prasa",
"pt": "Imprensa",
"ro": "Presa",
"ru": "Нажмите",
"sk": "Stlačiť",
"sv": "Media",
"tr": "Basın",
"zh_TW": "新聞"
},
"url": {
"en_US": "https://news.wheelmap.org/en/press/",
"de_DE": "https://news.wheelmap.org/press/"
}
},
{
"order": 4,
"label": {
"ar": "الاتصال بنا",
"bg": "Контакт",
"ca": "Contacte",
"cs": "Kontakt",
"da": "Kontakt",
"de": "Kontakt",
"el": "Επικοινωνία",
"es": "Contacto",
"fi": "Yhteys",
"he": "צור קשר",
"hu": "Kapcsolat",
"it": "Contatta",
"ja": "連絡先",
"ko": "연락처",
"mn": "Холбоо барих",
"no": "Kontakt",
"pl": "Kontakt",
"pt": "Contacto",
"ru": "Контакты",
"sk": "Kontakt",
"sv": "Kontakta",
"tr": "İletişim",
"zh_TW": "聯繫"
},
"url": {
"en_US": "https://news.wheelmap.org/en/contact/",
"de_DE": "https://news.wheelmap.org/contact/"
}
},
{
"order": 5,
"label": {
"ar": "طباعة",
"bg": "Данни за издателя",
"ca": "Peu de pagina",
"cs": "Otisk",
"da": "Aftryk",
"de": "Impressum",
"el": "Αποτύπωμα",
"es": "Aviso legal",
"fi": "Tietoa",
"fr": "Impression",
"he": "חותם",
"hu": "Impresszum",
"it": "Impronta",
"ja": "インプリント",
"ko": "인쇄",
"mn": "Дардас",
"nl": "Colofon",
"no": "Avtrykk",
"pl": "Informacje prawne",
"pt": "Sobre",
"ro": "Imprimeu",
"ru": "Импринт",
"sk": "Stopa",
"sv": "Om oss",
"tr": "Yayıncı",
"zh_TW": "版本說明"
},
"url": {
"en_US": "https://news.wheelmap.org/en/imprint/",
"de_DE": "https://news.wheelmap.org/imprint/"
}
},
{
"order": 6,
"label": {
"ar": "الأسئلة المتكررة",
"bg": "ЧЗВ",
"ca": "PMF",
"el": "Συχνές Ερωτήσεις",
"es": "Preguntas frecuentes",
"fi": "UKK",
"he": "שאלות נפוצות",
"hu": "GYIK",
"ja": "FAQ(よくある質問)",
"mn": "Түгээмэл Асуулт Хариулт",
"pt": "Perguntas Frequentes",
"ru": "ЧаВО",
"sk": "Častlo kladené otázky",
"sv": "Frågor & Svar",
"tr": "SSS",
"zh_TW": "常見問題"
},
"url": {
"en_US": "https://news.wheelmap.org/en/FAQ/",
"de_DE": "https://news.wheelmap.org/FAQ/"
}
}
]
.map((link, order) => Object.assign(link, { order, _id: makeid(), appId: 'localhost' }))
.forEach(link => db.AppLinks.insert(link));
@opyh
Copy link
Author

opyh commented Nov 6, 2018

Add the first code snippet inside i18n.js to generate translated links. Add the result to the second file.
Then open a MongoDB shell and execute load('addlinkstodb.js') in it to add these links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment