Skip to content

Commit

Permalink
use latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
nicmosc committed Feb 18, 2020
1 parent 17a1901 commit fd6d15c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dist/utils/conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ function lokaliseSort(a, b, object) {
// handle plural forms
return pluralForms.indexOf(a) - pluralForms.indexOf(b);
}
if (b.startsWith(a) && typeof aValue !== 'string' && !Object.keys(aValue).every(function (k) {
if (b.startsWith(a) && b.split(a)[0] === '' && b.split(a)[1].includes('_') && typeof aValue !== 'string' && !Object.keys(aValue).every(function (k) {
return pluralForms.includes(k);
})) {
// handle e.g. project vs project_item
return 1;
}
if (a.startsWith(b) && typeof bValue !== 'string' && typeof aValue !== 'string') {
if (a.startsWith(b) && a.split(b)[0] === '' && a.split(b)[1].includes('_') && typeof bValue !== 'string' && typeof aValue !== 'string') {
// handle e.g. project vs project_item
return -1;
}
Expand Down
9 changes: 9 additions & 0 deletions examples/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ en:
detailed: 'Over an expected total of %{total}'
title: 'Revenue from optioned units'
password: 'Your password'
style_options_label: 'Great, let’s continue - Choose an option below'
style_options:
feelingLucky: 'Looking for ideas'
topics:
item_not_destroyed: Something
item_not_loaded: Something
Expand All @@ -31,6 +34,12 @@ en:
technology:
code: 'This is the code we use'
installation: 'How to install our software'
production_tab:
description: 'Click on "Production" to see your items in more detail.'
production_table:
description: 'This list contains all the products you ordered for this project.'
extra_description: 'For each item you''ll be able to see its status, estimated delivery date, required actions etc.'
title: 'Production table'
units:
zero: ''
one: '%{count} unit'
Expand Down
5 changes: 4 additions & 1 deletion examples/src/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ option: Option
option_revenue:
detailed: 'Over an expected total of %{total}'
title: Revenue from optioned units
'true': 1
'true': 1
style_options_label: 'Great, let’s continue - Choose an option below'
style_options:
feelingLucky: 'Looking for ideas'
8 changes: 7 additions & 1 deletion examples/src/topics/tech/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ units:
one: '%{count} unit'
many: ''
other: '%{count} units'
units_title: Units
units_title: Units
production_tab:
description: 'Click on "Production" to see your items in more detail.'
production_table:
description: 'This list contains all the products you ordered for this project.'
extra_description: 'For each item you''ll be able to see its status, estimated delivery date, required actions etc.'
title: 'Production table'
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "louki",
"version": "2.0.0-beta.8",
"version": "2.0.0-beta.11",
"description": "Locale Organization Utility to manage locales",
"main": "src/index.js",
"repository": "https://github.com/Drawbotics/louki.git",
Expand All @@ -25,7 +25,7 @@
]
},
"dependencies": {
"@nicmosc/js-yaml": "^0.1.8",
"@nicmosc/js-yaml": "^0.1.11",
"babel-polyfill": "^6.23.0",
"commander": "^2.9.0",
"directory-tree": "^1.2.0",
Expand Down
8 changes: 7 additions & 1 deletion src/utils/conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ function lokaliseSort(a, b, object) {
return pluralForms.indexOf(a) - pluralForms.indexOf(b);
}
if (b.startsWith(a)
&& b.split(a)[0] === ''
&& b.split(a)[1].includes('_')
&& typeof aValue !== 'string'
&& ! Object.keys(aValue).every((k) => pluralForms.includes(k))) { // handle e.g. project vs project_item
return 1;
}
if (a.startsWith(b) && (typeof bValue !== 'string' && typeof aValue !== 'string')) { // handle e.g. project vs project_item
if (a.startsWith(b)
&& a.split(b)[0] === ''
&& a.split(b)[1].includes('_')
&& (typeof bValue !== 'string'
&& typeof aValue !== 'string')) { // handle e.g. project vs project_item
return -1;
}
return a.localeCompare(b);
Expand Down

0 comments on commit fd6d15c

Please sign in to comment.