Creation:2024-08-11Last update:2025-06-29
このドキュメントをあなたの好きなAIアシスタントに参照してくださいChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
このページとあなたの好きなAIアシスタントを使ってドキュメントを要約します
このページのコンテンツはAIを使用して翻訳されました。
英語の元のコンテンツの最新バージョンを見るEdit 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
ドキュメント: intlayer の getPathWithoutLocale 関数
説明
指定された URL またはパス名からロケールセグメントを削除します。絶対 URL と相対パス名の両方で動作します。
パラメーター
inputUrl: string- 説明: 処理する完全な URL 文字列またはパス名。
- 型:
string
locales: Locales[]- 説明: サポートされているロケールのオプション配列。プロジェクトで設定されたロケールがデフォルトになります。
- 型:
Locales[]
戻り値
- 型:
string - 説明: ロケールセグメントを除いた URL 文字列またはパス名。
使用例
typescript
コードをコピー
コードをクリップボードにコピー
import { getPathWithoutLocale } from "intlayer";
console.log(getPathWithoutLocale("/dashboard")); // 出力: "/dashboard"
console.log(getPathWithoutLocale("/en/dashboard")); // 出力: "/dashboard"
console.log(getPathWithoutLocale("/fr/dashboard")); // 出力: "/dashboard"
console.log(getPathWithoutLocale("https://example.com/en/dashboard")); // 出力: "https://example.com/dashboard"