
org.sonar.l10n.web.rules.Web.InternationalizationCheck.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-web-plugin Show documentation
Show all versions of sonar-web-plugin Show documentation
Enables scanning of HTML, and JSP/JSF files.
Web applications can be made available in multiple languages through the use of internationalization. This allows the server to plug in the correct
version of a piece of text based on the language chosen, but it requires that internationalization messages be used instead of hard-coded text.
Noncompliant Code Example
<form method="post">
<label for="username">Username:</label> <!-- Noncompliant -->
<input type="text" id="username" name="username">
<br>
<label for="password">Password:</label> <!-- Noncompliant -->
<input type="password" id="password" name="password">
<br>
<input type="submit" name="submit" value="${buttonValue}">
</form>
Compliant Solution
<form method="post">
<label for="username"><fmt:message key="login.label.username" />:</label>
<input type="text" id="username" name="username">
<br>
<label for="password"><fmt:message key="login.label.password" />:</label>
<input type="password" id="password" name="password">
<br>
<input type="submit" name="submit" value="${buttonValue}">
</form>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy