Creation:2024-08-11Last update:2025-06-29
Reference this doc to your favorite AI assistantChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Add the MCP Server to your AI Assistant
By integrating the Intlayer MCP Server to your favourite AI assistant can retrieve all the doc directly from ChatGPT, DeepSeek, Cursor, VSCode, etc.
See MCP Server docEdit this doc
If you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy
Copy doc Markdown to clipboard
Documentation: getPathWithoutLocale Functions in intlayer
Description
Removes the locale segment from the given URL or pathname if present. It works with both absolute URLs and relative pathnames.
Parameters
inputUrl: string
- Description: The complete URL string or pathname to process.
- Type: string
locales: Locales[]
- Description: Optional array of supported locales. Defaults to the configured locales in the project.
- Type: Locales[]
Returns
- Type: string
- Description: The URL string or pathname without the locale segment.
Example Usage
typescript
Copy code
Copy the code to the clipboard
import { getPathWithoutLocale } from "intlayer";console.log(getPathWithoutLocale("/dashboard")); // Output: "/dashboard"console.log(getPathWithoutLocale("/en/dashboard")); // Output: "/dashboard"console.log(getPathWithoutLocale("/fr/dashboard")); // Output: "/dashboard"console.log(getPathWithoutLocale("https://example.com/en/dashboard")); // Output: "https://example.com/dashboard"
Doc History
Version | Date | Changes |
---|---|---|
5.5.10 | 2025-06-29 | Init history |