Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7adcc43

Browse files
committedOct 16, 2023
[js] Optionally support ISO 3166-1 alpha-2
1 parent b2f389a commit 7adcc43

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎assets/js/bpd.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ if (menuToggle) {
2020
function loadLanguage(lang) {
2121
let base_pathname = window.location.pathname;
2222
// ISO 639-1 language codes are two-letter codes
23-
let lang_path_regex = /^\/[a-z]{2}([_-][a-z]+)?\//;
23+
// ISO 3166-1 alpha-2 country codes are two-letter codes
24+
let lang_path_regex = /^\/[a-z]{2}([_-][A-Z]{2})?\//;
2425

2526
// Check if the URL path is more than just /path/ and starts with a language code
2627
let path_parts = base_pathname.split("/");

0 commit comments

Comments
 (0)
Please sign in to comment.