Skip to content

Instantly share code, notes, and snippets.

View Peters8090's full-sized avatar

Piotr Bartoszewski Peters8090

  • GP Solutions
  • Warsaw, Poland
View GitHub Profile
@ditzel
ditzel / I18n.cs
Last active April 28, 2025 09:36
Internationalization - See code comments for usage
/*
* Internationalization
*
* Author: Daniel Erdmann
*
* 1. Add this File to you Project
*
* 2. Add the language files to the folder Assets/Resources/I18n. (Filesnames: en.txt, es.txt, pt.txt, de.txt, and so on)
* Format: en.txt: es.txt:
* =============== =================
// Change window.location.hash without scrolling the page, even in IE
// by renaming the element's id temporarily
function changeHashWithoutScrolling(hash) {
const id = hash.replace(/^.*#/, '')
const elem = document.getElementById(id)
elem.id = `${id}-tmp`
window.location.hash = hash
elem.id = id
}