Locates the filename based on the locale.
Example, assume file="/a/b.ext" and locale="zh_TW", then
the following files are tried in sequence:
/a/b_zh_TW.ext
/a/b_zh.ext
/a/b.ext
Unlike ClassLoader.getResource, it returns the found file,
not the URL. In the previous example, one of /a/b_zh_TW.ext,
/a/b_zh.ext and /a/b.ext will be returned.
To get the real URL, you still require locator.getResource:
locator.getResource(Locators.locate(locator, "/a/b.ext", locale));
Note: '_' is considered as a special character in the parsing,
so there might be problem if a filename contains '_' used other
than locale.
Parameters: locale - the locale; null means the current locale the URL containing proper locale characters; null if not found.Note: it could compare it with the file argument with ==, becausethis method will return the same string if it is the result. |