Skip to content

Commit bfc1ec0

Browse files
authored
CLDR-18475 deps, web: remove org.json from deps, fix rtl (#4566)
1 parent 516a506 commit bfc1ec0

39 files changed

+296
-114
lines changed

tools/cldr-apps/js/src/esm/cldrSurvey.mjs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ const timerSpeed = 15000; // 15 seconds
8787
const fastTimerSpeed = 3000; // 3 seconds
8888
let statusTimeout = null;
8989

90-
let overridedir = null;
91-
9290
/************************/
9391

9492
function getDidUnbust() {
@@ -812,18 +810,15 @@ function locInfo(loc) {
812810
return locmap.getLocaleInfo(loc);
813811
}
814812

815-
function setOverrideDir(dir) {
816-
overridedir = dir;
817-
}
818-
819813
/**
820814
* Set the dir and lang attributes for a node that represents
821815
* a CLDR value.
822816
* Also appends the 'cldrValue' class to the node.
823-
* @param {Node} node DOM node
824-
* @param {String} loc locale
817+
* @param {Node} node DOM node to be set
818+
* @param {String} loc locale (default locale if falsy)
819+
* @param {String} overridedir override the directionality (not used if falsy)
825820
*/
826-
function setLang(node, loc) {
821+
function setLang(node, loc, overridedir) {
827822
var info = locInfo(loc);
828823

829824
if (overridedir) {
@@ -979,7 +974,6 @@ export {
979974
localizeFlyover,
980975
parseStatusAction,
981976
setLang,
982-
setOverrideDir,
983977
setShower,
984978
showLoader,
985979
testsToHtml,

tools/cldr-apps/js/src/esm/cldrTable.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ function insertRowsIntoTbody(theTable, reuseTable) {
177177
for (let i in rowList) {
178178
const k = rowList[i];
179179
const theRow = theRows[k];
180-
const dir = theRow.dir;
181-
cldrSurvey.setOverrideDir(dir != null ? dir : null);
182180
/*
183181
* Don't regenerate the headings if we're re-using an existing table.
184182
*/
@@ -809,7 +807,7 @@ function updateRowProposedWinningCell(tr, theRow, cell, protoButton) {
809807
const flagIcon = cldrSurvey.addIcon(cell, "s-flag");
810808
flagIcon.title = cldrText.get("flag_desc");
811809
}
812-
cldrSurvey.setLang(cell);
810+
cldrSurvey.setLang(cell, null, theRow.dir);
813811
tr.proposedcell = cell;
814812

815813
/*
@@ -844,7 +842,7 @@ function updateRowProposedWinningCell(tr, theRow, cell, protoButton) {
844842
function updateRowOthersCell(tr, theRow, cell, protoButton) {
845843
let hadOtherItems = false;
846844
cldrDom.removeAllChildNodes(cell); // other
847-
cldrSurvey.setLang(cell);
845+
cldrSurvey.setLang(cell, null, theRow.dir);
848846

849847
/*
850848
* Add the other vote info -- that is, vote info for the "Others" column.

tools/cldr-apps/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@
110110
<artifactId>javax.activation</artifactId>
111111
</dependency>
112112

113-
<!-- https://mvnrepository.com/artifact/org.json/json -->
114-
<dependency>
115-
<groupId>org.json</groupId>
116-
<artifactId>json</artifactId>
117-
</dependency>
118-
119113
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
120114
<dependency>
121115
<groupId>org.jsoup</groupId>

tools/cldr-apps/src/main/java/org/unicode/cldr/util/CLDRConfigImpl.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,21 @@
1010
import java.net.URL;
1111
import java.util.Date;
1212
import java.util.Enumeration;
13-
import java.util.Map.Entry;
1413
import java.util.Properties;
1514
import java.util.jar.JarFile;
1615
import java.util.jar.Manifest;
1716
import java.util.logging.Logger;
1817
import javax.servlet.http.HttpServletRequest;
19-
import org.json.JSONException;
20-
import org.json.JSONObject;
21-
import org.json.JSONString;
2218
import org.unicode.cldr.test.CheckCLDR;
2319
import org.unicode.cldr.web.CookieSession;
2420
import org.unicode.cldr.web.SurveyLog;
2521
import org.unicode.cldr.web.SurveyMain;
2622
import org.unicode.cldr.web.SurveyMain.Phase;
2723
import org.unicode.cldr.web.UserRegistry;
2824
import org.unicode.cldr.web.WebContext;
25+
import org.unicode.cldr.web.util.JSONException;
26+
import org.unicode.cldr.web.util.JSONObject;
27+
import org.unicode.cldr.web.util.JSONString;
2928

3029
/**
3130
* This is a concrete implementation of CLDRConfig customized for SurveyTool usage. Its main
@@ -449,8 +448,8 @@ public JSONObject toJSONObject() throws JSONException {
449448
JSONObject ret = new JSONObject();
450449

451450
ret.put("CLDR_HEADER", ""); // always show these
452-
for (Entry<Object, Object> e : survprops.entrySet()) {
453-
ret.put(e.getKey().toString(), e.getValue().toString());
451+
for (final Object k : survprops.keySet()) {
452+
ret.put(k.toString(), survprops.get(k).toString());
454453
}
455454

456455
return ret;

tools/cldr-apps/src/main/java/org/unicode/cldr/web/AdminPanel.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import java.util.Random;
99
import javax.servlet.http.HttpServletRequest;
1010
import javax.servlet.http.HttpServletResponse;
11-
import org.json.JSONArray;
12-
import org.json.JSONException;
13-
import org.json.JSONObject;
1411
import org.unicode.cldr.util.CLDRConfig;
1512
import org.unicode.cldr.util.CLDRConfigImpl;
1613
import org.unicode.cldr.util.VoteResolver;
14+
import org.unicode.cldr.web.util.JSONArray;
15+
import org.unicode.cldr.web.util.JSONException;
16+
import org.unicode.cldr.web.util.JSONObject;
1717

1818
public class AdminPanel {
1919
public void getJson(
@@ -144,7 +144,7 @@ private void showExceptions(SurveyJSONWrapper r, HttpServletRequest request)
144144

145145
private void showSettings(SurveyJSONWrapper r) throws JSONException {
146146
CLDRConfigImpl cci = (CLDRConfigImpl) (CLDRConfig.getInstance());
147-
JSONObject all = new JSONObject().put("all", cci.toJSONObject());
147+
JSONObject all = new JSONObject().put("all", cci);
148148
r.put("settings", all);
149149
}
150150

tools/cldr-apps/src/main/java/org/unicode/cldr/web/BallotBox.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import java.util.Date;
55
import java.util.Map;
66
import java.util.Set;
7-
import org.json.JSONObject;
87
import org.unicode.cldr.util.VoteResolver;
98
import org.unicode.cldr.util.VoteType;
109
import org.unicode.cldr.web.UserRegistry.User;
10+
import org.unicode.cldr.web.util.JSONObject;
1111

1212
/**
1313
* @author srl This is an abstract interface for allowing SurveyTool-like input to a CLDRFile. It

tools/cldr-apps/src/main/java/org/unicode/cldr/web/ChunkyReader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
import java.util.Map;
2323
import java.util.TreeMap;
2424
import java.util.concurrent.TimeUnit;
25-
import org.json.JSONArray;
26-
import org.json.JSONException;
27-
import org.json.JSONObject;
28-
import org.json.JSONString;
2925
import org.unicode.cldr.util.CldrUtility;
3026
import org.unicode.cldr.util.Pair;
27+
import org.unicode.cldr.web.util.JSONArray;
28+
import org.unicode.cldr.web.util.JSONException;
29+
import org.unicode.cldr.web.util.JSONObject;
30+
import org.unicode.cldr.web.util.JSONString;
3131

3232
/**
3333
* This is only used by exception log readers

tools/cldr-apps/src/main/java/org/unicode/cldr/web/ClaGithubList.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.logging.Logger;
1717
import org.unicode.cldr.util.CLDRConfig;
1818
import org.unicode.cldr.util.CLDRConfigImpl;
19+
import org.unicode.cldr.web.util.JsonUtil;
1920

2021
/**
2122
* Utility class for reading a signatures.json file This file can be downloaded from
@@ -174,7 +175,7 @@ Map<String, SignEntry> readSigners(final Path path) throws IOException {
174175

175176
/** read from a Reader */
176177
Map<String, SignEntry> readSigners(final Reader r) throws IOException {
177-
final Gson gson = new Gson();
178+
final Gson gson = JsonUtil.gson();
178179
Map<String, SignEntry> allSigners = new HashMap<>();
179180
try (final JsonReader jr = gson.newJsonReader(r); ) {
180181
jr.beginArray();

tools/cldr-apps/src/main/java/org/unicode/cldr/web/DBUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@
4343
import javax.naming.NamingException;
4444
import javax.sql.DataSource;
4545
import org.apache.ibatis.jdbc.ScriptRunner;
46-
import org.json.JSONArray;
47-
import org.json.JSONException;
48-
import org.json.JSONObject;
4946
import org.unicode.cldr.icu.dev.util.ElapsedTimer;
5047
import org.unicode.cldr.util.CLDRConfig;
5148
import org.unicode.cldr.util.CLDRConfig.Environment;
5249
import org.unicode.cldr.util.CLDRLocale;
5350
import org.unicode.cldr.util.CldrUtility;
5451
import org.unicode.cldr.util.PathHeader;
5552
import org.unicode.cldr.util.StackTracker;
53+
import org.unicode.cldr.web.util.JSONArray;
54+
import org.unicode.cldr.web.util.JSONException;
55+
import org.unicode.cldr.web.util.JSONObject;
5656

5757
/** Singleton utility class for simple(r) DB access. */
5858
public class DBUtils {

tools/cldr-apps/src/main/java/org/unicode/cldr/web/ErrorSubtypes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import java.util.ArrayList;
66
import java.util.List;
77
import javax.servlet.http.HttpServletRequest;
8-
import org.json.JSONException;
9-
import org.json.JSONObject;
108
import org.unicode.cldr.test.CheckCLDR.CheckStatus.Subtype;
9+
import org.unicode.cldr.web.util.JSONException;
10+
import org.unicode.cldr.web.util.JSONObject;
1111

1212
public class ErrorSubtypes {
1313

0 commit comments

Comments
 (0)