“unable to run mksdcard sdk tool” error in Android Studio in Ubuntu

When First time you Going to Use Android Studio you might face the error.  (Check Issue https://code.google.com/p/android/issues/detail?id=82711 for more details)

“unable to run mksdcard sdk tool”

The way to resolve this error is run following commands

sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6

now run the Android studio again. You will See the issue was solved

Advertisements

Internationalization in jsp using Intellij Idea IDE.

When you develops a web application, It’s a best practice to develop localization. Today we are going to talk about how we are going to use localization. Using maven web template.

For this we need to correctly integrate jstl tags with our project. Use below link for it.

https://menukablog.wordpress.com/2016/05/10/add-jstl-tab-library-to-you-project-correctly/

I hope you have correctly integrate jstl tags. Not like above blog here we are going to use jstl fmt tags for localization. So first we need to make sure that our fmt tags integrated correctly. So add taglib url for both c and fmt to your test page like in the blog and add the below line in the <body><body>

<c:set var="balance" value="120000.2309" />
 <p>Formatted Number (1): <fmt:formatNumber value="${balance}"
 type="currency"/></p>

If you get the out put equals to below you correctly have integrated the taglibs for both and fmt.

Number Format:

Formatted Number (1): £120,000.23

Now get back to the localization. first of all you need files to store your different words. the naming convention normally will be like this.

whatevername_languagecode.properties

So for an example if i use language file name as Language, my English file name will be like Language_en.properties 

Refer below link for formal country codes.

http://www.science.co.il/Language/Locale-codes.asp

So next step is to where store your language files. If you follow my above mentioned blog, your place of language files will be resources folder.

example maven web archtype project structure

Here I have used messages_en.properties as my English word storing file (I got the Language_en.properties for example but I said we can use any name instead). Note that country code is important when you need to change your language in web app, so follow official standard as we mentioned in the above.

So Now we are ready to use localization.

First lets add some contents to our language files. Create to files in resources as we mentioned before. Here I’m going to create languages for English and Spanish

engli

spanis

See just you want to change the value of variable according to language. lets check a demo. create a .jsp file and add this content.

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<title></title>
</head>
<body>

<fmt:setLocale value="es"/>
<fmt:setBundle basename="messages" var="lang"/>

<fmt:message key="login.title" bundle="${lang}"/>

</body>
</html>

We use below tags to indicate which language and where to look.

<fmt:setLocale value=”en”/>
<fmt:setBundle basename=”messages” var=”lang”/>

setLocale will set which language is we are going to use and setBundle will indicate where to look. Here in Intellij we just need to give the language files name because it’s in the resources folder. Of course you can use a package for store language files then basename should be your package where language files are.

Now run the file (right click -> Run yourjsp.jsp in Intellij). If you can see the

dfvdfg

then change value of set locale to es (instead of en). Then run it again. You should able to see

adcasdasdsa