Question: I want to click on a link on site1 that leads to site2 and if the link has been clicked the hidden text (here: text\_1\_toggle) on that page should be visible.

P.S. I'm pretty new to this topic..so forgive me if i don't understand your answers right away :)

site1:

```
<html>
<head>
</head>
<body>

  <a href="site2.htm#text_1_toggle">Click me!</a>

</body>
</html>

```

site2:

```
<html>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="toggle.js"></script>
  <style>
        h4:hover
        {
            cursor: pointer; 
            cursor: hand;
        }
        #text_1_toggle
        {
            display: none;
        }
    </style>
</head>
<body> 
  <div id="site">
      <h4 id="text_1">Text 1</h4>
      <span id="text_1_toggle">     
      1 some text...
      </span>

    <h4 id="text_2">Text 2</h4>
      <span id="text_2_toggle">     
      2 some text...
      </span>   
  </div>
</body>

```

toggle.js

```
jQuery("#site").ready(function()
{
  jQuery("#text_1").click(function()
  {
    jQuery("#text_1_toggle").toggle();
  });    

  jQuery("#text_2").click(function()
  {
    jQuery("#text_2_toggle").toggle();
  });
}); 

```

Answer: 
I found no "simple" solution, but could get around this task like this.
Tested within Android Studio and on 6.0.1 Android.

First, in res/strings.xml: within 'resources' tag, specify your localized true / false values like this:

```
<string name="TRUE">Ja</string>
<string name="FALSE">Nein</string>

```

Define your string with xliff tag use **%s** (NOT %b!) like this:

```
<string name="does_mary_have_a_little_lamb">Does Mary have a little lamb? <xliff:g name="trueFalse" example="true">%s</xliff:g>

```

\*\*The below example is within mainActivity.java class. Your application may differ. Please mind the namespace. \*\*

In your java code create a function to convert boolean values to localized string representation:

```
/**
 * function to convert boolean values to localized true / false strings
 * @param b boolean to be translated
 * @return String containing localized true / false message
 */
private String translateBoolean(boolean b) {
    String trueFalse = Boolean.toString(b).toUpperCase(); // true / false is a reserved keyword, so convert to TRUE / FALSE
    String packageName = getPackageName();
    int resId = getResources().getIdentifier(trueFalse, "string", packageName);

    // this is to make sure that we got a valid resId else getString() will force close
    if (resId > 0) {
        return getString(resId);
    }
    else
    {
        return trueFalse; // provide a fallback 'true/false' if translation is not available
    }
}

```

Then use it in your string functions like this:

```
String output = getString(R.string.does_mary_have_a_little_lamb,translateBoolean(hasLittleLamb)) + "\n";

```

You could easily extend the above example to account for yes/no, up/down etc. translations. As this method is pretty expensive you could consider caching the results if you heavily use it.
im in the android class also.. i think the print formater for boolean is "%B"
its with a capital "B" not a lower case "b". See u on slack..

```
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="whip">whip?<xliff:g id="whip">%B</xliff:g></string>
</resources>

private String createOrderSummary(int price) {
    String mess = "Name: "+ getName() +"\n";
    mess += getString(R.string.add_whipped_cream, whip);///whip IS A BOOL VAL.
    return  mess;
}

```