Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swedish translation #270

Closed
wants to merge 1 commit into from
Closed

Swedish translation #270

wants to merge 1 commit into from

Conversation

CalvinMcGee
Copy link
Contributor

Added swedish translation.

Signed-off-by: Joachim Nyqvist <Joachim@JNyqvist.se>
@sferik
Copy link
Collaborator

sferik commented Feb 3, 2011

Tack.

meghaarora42 added a commit to meghaarora42/rails_admin that referenced this pull request Sep 28, 2015
The exisiting structure used an Object as a cache where the keys are the
values of option elements, and values are the HTML content of the option
elements. In Javascript, if a numeric value in the form of a string is
assigned as a key, it gets converted to an integer. Optimization
routines would then order the object to ensure faster access to
elements. For example:

cache = {}
cache['2'] = "two"
cache['1'] = "one"
console.log(cache[2])  #=> "two"
console.log(cache[1])  #=> "one"
console.log(cache)     #=> {1: "one", 2: "two"}

Note the coercion of strings to ints above. This messes with the
ordering of multiselect options list whenever there is a user input. To
avoid this from happening, the keys need to have a string that can't be
coerced automatically, and then preserve the value of the option
element.

I chose to use an object that stores the option value and the option
HTML as the value of the cache and a string of the format 'o_<option
value>' as the key. This ensures that the insertion order is preserved.
This is the new structure:

cache = {
  'o_271': { id: 271, value: 'CartItem railsadminteam#271'},
  'o_270': { id: 270, value: 'CartItem railsadminteam#270}'
}
meghaarora42 added a commit to meghaarora42/rails_admin that referenced this pull request Sep 28, 2015
The existing structure used an Object as a cache where the keys are the
values of option elements, and values are the HTML content of the option
elements. In Javascript, if a numeric value in the form of a string is
assigned as a key, it gets converted to an integer. Optimization
routines would then order the object to ensure faster access to
elements. For example:

cache = {}
cache['2'] = "two"
cache['1'] = "one"
console.log(cache[2])  #=> "two"
console.log(cache[1])  #=> "one"
console.log(cache)     #=> {1: "one", 2: "two"}

Note the coercion of strings to ints above. This messes with the
ordering of multiselect options list whenever there is a user input. To
avoid this from happening, the keys need to have a string that can't be
coerced automatically, and then preserve the value of the option
element.

I chose to use an object that stores the option value and the option
HTML as the value of the cache and a string of the format 'o_<option
value>' as the key. This ensures that the insertion order is preserved.
This is the new structure:

cache = {
  'o_271': { id: 271, value: 'CartItem railsadminteam#271'},
  'o_270': { id: 270, value: 'CartItem railsadminteam#270}'
}
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants