code: public static boolean isFallbackOf(String parent, String child) {
          if (!child.startsWith(parent)) {
              return false;
          }
          int i = parent.length();
          return (i == child.length() ||
                  child.charAt(i) == '_');
      }
docs: Compare two locale strings of the form aa_BB_CC, and
  return true if parent is a 'strict' fallback of child, that is,
  if child =~ "^parent(_.+)*" (roughly).