GlobalizationHelper | UrlParsing |
Helps with globalizaton.
Gets the culture, either from the specified URL or the current HTTP context items.
Name | Description |
---|---|
url | System.String The URL to attempt to extract the culture from. |
The culture (e.g., "es-mx").
This function will first attempt to extract the culture from the specified URL. If the URL does not incdicate the culture, it will attemp to exract the culture from the current HTTP context items.
Returns the culture stored in the current HTTP context items.
The culture, or null.
This will not inspect the URL in the current HTTP request.
Stores the specified culture in the current HTTP context items.
Name | Description |
---|---|
culture | System.String The culture to store. |
Assists with parsing globalized URL's.
Static constructor.
The regex used to match the culture prefix (e.g., "/en-us") in a URL.
The regex used to match the culture (e.g., "en-us") in a URL.
Extracts the culture from the specified URL.
Name | Description |
---|---|
url | System.String The URL (e.g., "http://www.rhythmagency.com/en-us/some-path"). |
The culture (e.g., "en-us").
The URL doesn't need to include the domain.
Extracts the language from the specified URL.
Name | Description |
---|---|
url | System.String The URL (e.g., "http://www.rhythmagency.com/en-us/some-path"). |
The language (e.g., "en").
The URL doesn't need to include the domain.
Returns the path for a URL, minus the culture portion.
Name | Description |
---|---|
url | System.String The URL (e.g., "http://www.rhythmagency.com/en-us/some-path?some=path"). |
The path, without the culture (e.g., "/some-path?some=path").
Returns the path for a URL, minus the culture portion, and minus the query string.
Name | Description |
---|---|
url | System.String The URL (e.g., "http://www.rhythmagency.com/en-us/some-path?some=path"). |
The path, without the culture (e.g., "/some-path").
Extracts the region from the specified URL.
Name | Description |
---|---|
url | System.String The URL (e.g., "http://www.rhythmagency.com/en-us/some-path"). |
The region (e.g., "us").
The URL doesn't need to include the domain.
Prefixes a culture to a URL.
Name | Description |
---|---|
url | System.String The URL (e.g., "/about/company"). |
culture | System.String The culture code (e.g., "en-us"). |
The URL with a prefixed culture (e.g., "/en-us/about/company").
The regex used to match the region in a URL.
Will match "us" in the URL "/en-us/some-path".