Skip to content

Commit

Permalink
(1.2) Added translation of titles (uppercase and lowercase)
Browse files Browse the repository at this point in the history
Referred to #1:
Languages now supported:
- Arabic (ar)
- German (de)
- French (fr)
- Spanish (es): Spain (ES), Argentina (AR), Chile (CL) and Mexico (MX)
- Italian (it)
- Japanese (ja)
- Portuguese (pt): Portugal (PT) and Brazil (BR)
- Chinese (zh): Simplified (CN) and Traditional (TW)
- (default and) English (en): British (GB), American (US) and Canadian (CA), but also other languages not supported
  • Loading branch information
Sav22999 committed Dec 9, 2019
1 parent 8149a25 commit bffafb7
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 2 deletions.
2 changes: 1 addition & 1 deletion accentedletters.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!---
Created by Saverio Morelli - saveriomorelli.com
version 1.1.2 - last update 2019-12-01
version 1.2 - last update 2019-12-09
--->
<html>
<head>
Expand Down
67 changes: 67 additions & 0 deletions js/accentedletters.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,77 @@ function setLowerUpperCase(type)
document.getElementById("uppercase").style.borderTopColor="transparent";
document.getElementById("uppercase").style.color="black";
}
}

function setUILanguage()
{
var lang=browser.i18n.getUILanguage().toString();
var uppercase_title="", lowercase_title="";
switch (lang) {
case "ar":
//Arabic
uppercase_title="الأحرف الكبيرة";
lowercase_title="أحرف صغيرة";
break;

case "de":
//German
uppercase_title="Großbuchstaben";
lowercase_title="Kleinbuchstaben";
break;

case "es-ES":
case "es-AR":
case "es-CL":
case "es-MX":
//Spanish (Spain-ES), but also Spanish (Argentina-AR), Spanish (Chile-CL) and Spanish (Mexico-MX)
uppercase_title="Mayúscula";
lowercase_title="Minúscula";
break;

case "fr":
//French
uppercase_title="Majuscule";
lowercase_title="Minuscule";
break;

case "it":
//Italian
uppercase_title="Maiuscolo";
lowercase_title="Minuscolo";
break;

case "ja":
//Japanese
uppercase_title="大文字";
lowercase_title="小文字";
break;

case "pt-PT":
case "pt-BR":
//Portuguese (Portugal-PT), but also Portuguese (Brazilian-BR)
uppercase_title="Maiúsculas";
lowercase_title="Minúsculas";
break;

case "zh-CN":
case "zh-TW":
//Chinese (Simplified-CN), but also Chinese (Traditional-TW)
uppercase_title="大写";
lowercase_title="小写字母";
break;

default:
//other languages, and also en-GB (British-GB), en-US (American-US), en-CA (Canadian-CA)
uppercase_title="Uppercase";
lowercase_title="Lowercase";
}
document.getElementById("uppercase").value=uppercase_title;
document.getElementById("lowercase").value=lowercase_title;
}

setLowerUpperCase("lower");
setUILanguage();

// button click events
document.getElementById("lowercase").onclick = function(e){setLowerUpperCase("lower");};
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Accented Letters",
"version": "1.1.2",
"version": "1.2",

"description": "It permits just with a single click to copy an accented letter.",

Expand Down

0 comments on commit bffafb7

Please sign in to comment.