Skip to content
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-16560 Requirements for storing inheritance marker, revert last PR #2856

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions tools/cldr-apps/src/main/java/org/unicode/cldr/web/STFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;

import com.ibm.icu.util.Output;
import org.unicode.cldr.test.CheckCLDR;
import org.unicode.cldr.test.DisplayAndInputProcessor;
import org.unicode.cldr.test.TestCache;
Expand Down Expand Up @@ -231,41 +230,11 @@ private VoteResolver<String> setValueFromResolver(String path, VoteResolver<Stri
}
delegate.removeValueAtDPath(path);
if (value != null) {
value = reviseInheritanceAsNeeded(path, value);
delegate.putValueAtPath(fullPath, value);
}
return resolver;
}

/**
* Get the possibly modified value. If value matches the bailey value or inheritance marker, possibly
* change it from bailey value to inheritance marker, or vice-versa, as needed to meet these requirements:
* 1. If the path changes when getting bailey, then we are inheriting sideways. We need to use a hard value.
* 2. If the value is different from the bailey value, can't use inheritance; we need a hard value.
* 3. Otherwise we use inheritance marker.
*
* @param path the path
* @param value the input value
* @return the possibly modified value
*/
private String reviseInheritanceAsNeeded(String path, String value) {
if (value != null) {
CLDRFile cldrFile = make(ballotBox.locale.getBaseName());
if (cldrFile != null) {
if (!cldrFile.isResolved()) {
throw new InternalCldrException("must be resolved");
}
Output<String> pathWhereFound = new Output<>();
Output<String> localeWhereFound = new Output<>();
String baileyValue = cldrFile.getBaileyValue(path, pathWhereFound, localeWhereFound);
if (baileyValue != null && (CldrUtility.INHERITANCE_MARKER.equals(value) || baileyValue.equals(value))) {
return pathWhereFound.value.equals(path) ? CldrUtility.INHERITANCE_MARKER : baileyValue;
}
}
}
return value;
}

private String getFullPathWithResolver(String path, VoteResolver<String> resolver) {
String diskFullPath = ballotBox.diskData.getFullPathAtDPath(path);
if (diskFullPath == null) {
Expand Down