-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLDR-16835 Non-TC locales and extended locales remain open longer #3795
Changes from 6 commits
a4718a3
8ece119
ef44a9d
c9f8908
86af6e4
44e0b01
701415f
b90be94
ad7d408
9c197a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,7 @@ | |
import org.unicode.cldr.test.CheckCLDR; | ||
import org.unicode.cldr.test.ExampleGenerator; | ||
import org.unicode.cldr.test.HelpMessages; | ||
import org.unicode.cldr.test.SubmissionLocales; | ||
import org.unicode.cldr.util.CLDRCacheDir; | ||
import org.unicode.cldr.util.CLDRConfig; | ||
import org.unicode.cldr.util.CLDRConfigImpl; | ||
|
@@ -209,6 +210,7 @@ public String display() { | |
|
||
// ===== Configuration state | ||
private static Phase currentPhase = Phase.VETTING; | ||
private static Phase currentDdlPhase = Phase.VETTING; | ||
/** set by CLDR_PHASE property. * */ | ||
private static String oldVersion = "OLDVERSION"; | ||
|
||
|
@@ -2077,9 +2079,9 @@ public String getLocaleLink(WebContext ctx, CLDRLocale locale, String n) { | |
if (canModify) { | ||
rv = rv + (modifyThing(ctx)); | ||
int odisp; | ||
if ((SurveyMain.phase() == Phase.VETTING | ||
|| SurveyMain.phase() == Phase.SUBMIT | ||
|| isPhaseVettingClosed()) | ||
if ((SurveyMain.phase(locale) == Phase.VETTING | ||
|| SurveyMain.phase(locale) == Phase.SUBMIT | ||
|| isPhaseVettingClosed(locale)) | ||
&& ((odisp = DisputePageManager.getOrgDisputeCount(ctx)) > 0)) { | ||
rv = rv + ctx.iconHtml("disp", "(" + odisp + " org disputes)"); | ||
} | ||
|
@@ -2823,6 +2825,24 @@ private void doStartup() { | |
+ phaseString); | ||
} | ||
currentPhase = newPhase; | ||
String ddlPhaseString = survprops.getProperty("CLDR_DDL_PHASE", null); | ||
Phase ddlPhase = null; | ||
try { | ||
if (ddlPhaseString != null && !ddlPhaseString.isEmpty()) { | ||
if (currentPhase == Phase.READONLY) { | ||
busted( | ||
"Error: Cannot have a CLDR_DDL_PHASE when CLDR_PHASE=READONLY. Remove the CLDR_DDL_PHASE."); | ||
btangmu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
ddlPhase = (Phase.valueOf(ddlPhaseString)); | ||
} | ||
} catch (IllegalArgumentException iae) { | ||
logger.warning("Error trying to parse CLDR_DDL_PHASE: " + iae); | ||
} | ||
if (ddlPhase == null) { | ||
ddlPhase = newPhase; | ||
logger.warning("CLDR_DDL_PHASE matches main phase " + ddlPhase); | ||
} | ||
currentDdlPhase = ddlPhase; | ||
} | ||
logger.info("Phase: " + phase() + ", cPhase: " + phase().getCPhase()); | ||
progress.update("Setup props.."); | ||
|
@@ -3554,8 +3574,8 @@ public static String localhost() { | |
|
||
// ============= Following have to do with phases | ||
|
||
public static boolean isPhaseVettingClosed() { | ||
return phase() == Phase.VETTING_CLOSED; | ||
public static boolean isPhaseVettingClosed(CLDRLocale locale) { | ||
return phase(locale) == Phase.VETTING_CLOSED; | ||
} | ||
|
||
public static boolean isPhaseReadonly() { | ||
|
@@ -3570,6 +3590,21 @@ public static Phase phase() { | |
return currentPhase; | ||
} | ||
|
||
public static Phase phase(CLDRLocale locale) { | ||
return (SubmissionLocales.isTcLocale(locale) ? phase() : getDDLPhase()); | ||
} | ||
|
||
/** | ||
* @returns the current phase for the locale. This is the preferred API. | ||
*/ | ||
public static CheckCLDR.Phase getCPhase(CLDRLocale loc) { | ||
return phase(loc).getCPhase(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "C" for "current" is a little cryptic; I didn't know what it stood for until I got here. How about getCurrentPhase? Or a name that clarifies this method is appropriate for both DDL and non-DDL locales? It seems like a terminology is needed, distinguishing 3 categories:
There's also the long-standing confusion between CheckCLDR.Phase and SurveyMain.Phase, which still makes my head spin. Of course, fixing that is out of the scope of this ticket, but as long as new methods are being named, it would SO helpful for the new methods/data to use a naming convention that distinguishes them -- maybe checkPhase vs stPhase? Also, it seems error prone to have three public methods: phase(), phase(locale), and getCPhase(loc). If the no-argument phase() ignores the existence of DDL, what ensures that various modules are consistent in treating DDL differently from non-DDL? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's not current, it's CheckCLDR. CheckCLDR added its own 'Phase' enum distinct from ST's, and they haven't been fully reconciled yet. It's the "long-standing confusion between CheckCLDR.Phase and SurveyMain.Phase". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will work on making these more clearer and consistent. Perhaps phase() could be renamed to overallPhase() or something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And that would need to be overallPhase(locale), right? Without the locale, it can't be overall. So ideally, phase() without a locale parameter might be private? currently it has about 14 callers (before this PR) (not counting jsp) |
||
} | ||
|
||
public static Phase getDDLPhase() { | ||
return currentDdlPhase; | ||
} | ||
|
||
public static String getOldVersion() { | ||
return oldVersion; | ||
} | ||
|
@@ -3642,6 +3677,7 @@ private class StatusForFrontEnd implements JSONString { | |
private final int pages = SurveyMain.pages; | ||
private Object permissions = null; | ||
private final Phase phase = phase(); | ||
private final Phase ddlPhase = getDDLPhase(); | ||
private String sessionId = null; | ||
private final String specialHeader = getSpecialHeaderText(); | ||
private final long surveyRunningStamp = SurveyMain.surveyRunningStamp.current(); | ||
|
@@ -3675,6 +3711,7 @@ private JSONObject toJSONObject() throws JSONException { | |
.put("pages", pages) | ||
.put("permissions", permissions) | ||
.put("phase", phase) | ||
.put("ddlPhase", ddlPhase) | ||
.put("sessionId", sessionId) | ||
.put("sessionMessage", sessionMessage) | ||
.put("specialHeader", specialHeader) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally this title might include ddlPhase, since "extended" is vague -- extended to what?