docs: private String addLocale(Locale locale, String url, String encodedParamName, String encoding) {
  		// Split the anchor
  		int poundPos = url.lastIndexOf('#');
  		String beforeAnchor;
  		String anchor;
  		if(poundPos==-1) {
  			beforeAnchor = url;
  			anchor = null;
  		} else {
  			anchor = url.substring(poundPos);
  			beforeAnchor = url.substring(0, poundPos);
  		}
  		// Only add for non-excluded file types
  		if(isLocalizedPath(beforeAnchor)) {
  			int questionPos = beforeAnchor.lastIndexOf('?');
  			// Only rewrite a URL that does not already contain a paramName parameter.
  			if(
  				questionPos == -1
  				|| (
  					!beforeAnchor.startsWith("?"+encodedParamName+"=", questionPos)
  					&& beforeAnchor.indexOf("&"+encodedParamName+"=", questionPos + 1) == -1
  				)
  			) {
  				try {
  					beforeAnchor += (questionPos == -1 ? '?' : '&') + encodedParamName + '=' + URLEncoder.encode(toLocaleString(locale), encoding);
  				} catch(UnsupportedEncodingException e) {
  					// Should never happen with standard supported encoding
  					throw new WrappedException(e);
  				}
  			}
  			return
  				(anchor != null)
  				? (beforeAnchor + anchor)
  				: beforeAnchor
  			;
  		} else {
  			// Unmodified
  			return url;
  		}
  	}