All language subtitles for 037 Challenge 18_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,410 --> 00:00:00,680 All right. 2 00:00:00,690 --> 00:00:03,620 So here comes the next problem that we have to solve. 3 00:00:03,810 --> 00:00:11,670 As I showed you before, if we head over to compose and we created a new post that just had a title of 4 00:00:11,670 --> 00:00:19,980 Test an our URL if we type posts/Test spelt at exactly the same way as our title when we hit 5 00:00:20,010 --> 00:00:23,280 enter then we get match found 6 00:00:23,280 --> 00:00:23,720 right? 7 00:00:23,910 --> 00:00:30,900 But here's a problem. Let's say if I go into my Atom and if the requestedTitle is not equal to any of 8 00:00:30,900 --> 00:00:34,070 the store title I have, I'm going to use else 9 00:00:34,110 --> 00:00:37,270 and then I'm going to log not a match. 10 00:00:37,680 --> 00:00:41,380 So now if I again go and create my Test post 11 00:00:41,700 --> 00:00:47,140 and now inside my home page I've got home and test. I can see that I've got that there 12 00:00:47,160 --> 00:00:48,420 but in the URL 13 00:00:48,450 --> 00:00:57,750 if I put /posts/test with a lowercase 't', in this case once I hit enter inside my 14 00:00:57,750 --> 00:01:00,690 console you can see I get not a match. 15 00:01:00,960 --> 00:01:08,160 And that is because in our code we're testing to see if storedTitle is equal to requestedTitle. 16 00:01:08,400 --> 00:01:14,680 And if the requestedTitle had a lowercase t and our storedTitle because it's a title right? 17 00:01:14,790 --> 00:01:16,860 It probably has a title case right? 18 00:01:16,850 --> 00:01:19,600 So most of the words are capitalized. Then 19 00:01:19,650 --> 00:01:21,550 this is not going to be true. 20 00:01:21,870 --> 00:01:27,630 But in most cases, URLs should be lowercase. so it doesn't really make sense to put in a capital 21 00:01:27,630 --> 00:01:30,630 T in there, it looks very very weird. 22 00:01:30,630 --> 00:01:35,610 The other problem we have is that when you look at some of the blog posts say medium right? 23 00:01:35,760 --> 00:01:41,070 You can see that they use word - word as their formatting for the URL. 24 00:01:41,340 --> 00:01:44,880 And this is what we call kebab case in programming. 25 00:01:44,880 --> 00:01:52,530 Now if I had a post that has two words in his title and I tried to use kebab case on it, say / 26 00:01:52,530 --> 00:01:54,540 posts/ 27 00:01:54,540 --> 00:01:57,810 Another-post, 28 00:01:57,810 --> 00:02:00,770 then it's also going to be not a match 29 00:02:00,780 --> 00:02:02,100 right? 30 00:02:02,160 --> 00:02:03,750 How do we solve this? 31 00:02:03,780 --> 00:02:11,110 I want to introduce you to something that developers use a lot with Node which is something called Lodash. 32 00:02:11,430 --> 00:02:20,020 And this is simply a utility library that makes it easier to work with Javascript inside your Node apps. 33 00:02:20,340 --> 00:02:27,850 If you head over here to lodash.com you can see how to install it, how to use it inside Node. 34 00:02:28,050 --> 00:02:29,600 Now here comes the challenge. 35 00:02:29,610 --> 00:02:34,290 The goal of this challenge is for you to read through the documentation of Lodash 36 00:02:34,500 --> 00:02:38,930 and I want you to have experience and practice in implementing the documentation. 37 00:02:39,210 --> 00:02:46,500 We've already used a couple of libraries now such as Express, EJS, Requests and I want you to have practice 38 00:02:46,590 --> 00:02:51,010 of implementing the documentation in a safe kind of environment 39 00:02:51,030 --> 00:02:53,620 right? Because I'll show you how to do it very soon. 40 00:02:53,730 --> 00:02:55,250 But I want you to give it a go. 41 00:02:55,350 --> 00:03:01,300 And once you've installed it and required it, then I want you to head over to the documentation. And if 42 00:03:01,300 --> 00:03:09,930 you search for lowercase then you can see that they have a method that allows you to turn all strings 43 00:03:10,020 --> 00:03:11,640 into a lower case. 44 00:03:11,920 --> 00:03:17,850 And if you look at the example it actually goes much further than that. It will in fact ignore all of 45 00:03:17,850 --> 00:03:24,630 the hyphens or the underscores and it will simply just give you a pure string to work with. 46 00:03:24,630 --> 00:03:32,130 So you should be able to use this library in order to make this URL actually give us a match for this 47 00:03:32,190 --> 00:03:33,620 particular title. 48 00:03:33,660 --> 00:03:37,930 When I type in this URL after you are done with implementing Lodash 49 00:03:38,370 --> 00:03:46,780 and when I hit enter, in our console we should see match found. Pause the video and try to complete this challenge. 50 00:03:48,060 --> 00:03:50,770 So here's hint number 1. 51 00:03:50,820 --> 00:03:56,640 If you check out lodash.com you can see they tell you how to install it and it shows you how to do 52 00:03:56,640 --> 00:03:57,800 it using NPM. 53 00:03:57,800 --> 00:04:02,990 And this is pretty familiar to us by now. We just have to install Lodash right? 54 00:04:03,000 --> 00:04:04,200 So let's go ahead and do that. 55 00:04:04,200 --> 00:04:10,750 Let's head over to hyper and let's Control + C to quit our current nodemon session. And 56 00:04:11,100 --> 00:04:15,780 we're going to use npm i or npm install whichever way you prefer. 57 00:04:16,019 --> 00:04:21,420 And then we're going to spell out lodash and make sure that you have the right spelling. 58 00:04:21,420 --> 00:04:22,470 Then we hit enter 59 00:04:22,530 --> 00:04:25,980 and that gets installed to our current project. 60 00:04:25,980 --> 00:04:32,280 The next thing you see here in the documentation is how to use it using Node.js which is perfect 61 00:04:32,280 --> 00:04:32,950 right? 62 00:04:33,060 --> 00:04:37,120 And you can see this familiar require thing that we've got going on. 63 00:04:37,320 --> 00:04:44,970 And the thing about Lodash is that a Lodash actually refers to this which is known to some people 64 00:04:45,000 --> 00:04:46,710 as an underscore. 65 00:04:46,710 --> 00:04:53,690 And so their preferred way of working with Node is to create a new variable or constant 66 00:04:53,700 --> 00:05:00,750 if you're using your versions of Javascript that is simply just a underscore and you set that to be 67 00:05:00,780 --> 00:05:02,420 the Lodash library. 68 00:05:02,790 --> 00:05:09,420 And then when you go to the documentation and you want to use one of its methods say the one we want 69 00:05:09,420 --> 00:05:17,060 which is lower case, then you simply have underscore or lodash .lowercase and then in between 70 00:05:17,130 --> 00:05:20,330 you pass in the string that you want to change into lowercase. 71 00:05:20,550 --> 00:05:24,470 See if that is enough of a hint to be able to complete the challenge. 72 00:05:26,290 --> 00:05:27,290 So here comes hint 73 00:05:27,310 --> 00:05:35,560 number 2. In order for our requestedTitle to match with our storedTitle we need to reformat them so they're 74 00:05:35,650 --> 00:05:38,120 both in the same format. 75 00:05:38,380 --> 00:05:44,590 And it doesn't matter whatever it is that the user typed in here. It could be uppercase, lowercase, kebab 76 00:05:44,590 --> 00:05:47,400 case, snake case, whatever it may be. 77 00:05:47,440 --> 00:05:52,750 We want to convert it to the same format in order to work with it and compare it. 78 00:05:52,750 --> 00:05:58,660 And that means that we have to format the storedTitle using that same lowercase method as well so that 79 00:05:58,660 --> 00:06:00,200 they are equatable. 80 00:06:00,250 --> 00:06:04,300 Pause the video now and see if you can now complete the challenge. 8050

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.