-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
New translations added. #271
New translations added. #271
Conversation
src/localize.js
Outdated
@@ -10,6 +10,7 @@ import * as pl from './translations/pl.json'; | |||
import * as it from './translations/it.json'; | |||
import * as ru from './translations/ru.json'; | |||
import * as es from './translations/es.json'; | |||
import * as es_419 from './translations/es.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import * as es_419 from './translations/es.json'; |
es_419
is using the same file as es
, so we don’t need to add it. You can use es
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Home Assistant offers the chance to pick between Español
(Spanish) and Español (Latinoamerica)
(Latinamerican Spanish).
Both have different language tags, es
and es-419
. Please, check the selectedLanguage
attribute in the screenshot, in the PR description.
The easy way to support this language (es-419) is using the same translations as Spanish, that's why I'm importing again the file, but with a different name.
Another approach would be creating a different file es-419.json
, and support both languages separately.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick check on the HA translation website:
Region specific translations (en-US, fr-CA) will only be included if translations for that region need to differ from the base language translation.
I was expecting that HA fallback policy will automatically select es
, when es-419
is not available if I understood the sentence above correctly.
Quick question: When es-419
is not available HA is falling back to en
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not 100% familiar with this card code, but as far as I can tell you're not using HA translation functionality.
This card is using a custom-made localize
function which only relies on the JSON files that you have in your repo.
IDK if HA is falling back es-419
to es
(I would assume, yes) but if so, in this case, is totally irrelevant, because you're getting the translations not from HA but your repo JSON files.
Probably I'm wrong, but that is what I can see from the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then probably the best solution is to add the fallback from es-419
to es
(obviously the general approach, which works also for fr-CA
) directly in https://github.com/custom-cards/boilerplate-card/blob/master/src/localize/localize.ts
When merged, then we can use the updated version.
They advantages of this solution is that, we need only translate words in the specific language if they are different (same approach as HA).
Also many cards use the boileplate code and so they can update to the new version.
Correct me if I'm wrong but you have set the language to es-419
and there it would be great to have at least a spanish translation if en-419
is not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this, will create a PR in the boilerplate-card to use fallback languages, thanks.
Please, resolve the review comments. |
# [2.2.0](v2.1.0...v2.2.0) (2021-11-06) ### Features * New translations added for ES. ([#271](#271)) ([690fb86](690fb86))
🎉 This PR is included in version 2.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# 1.0.0 (2024-05-28) ### Bug Fixes * "Encontrar" replaced by "Localizar" as a more adequate translation ([649162c](649162c)) * add and translate missing states ([denysdovhan#231](https://github.com/cociweb/lawn-mower-card/issues/231)) ([8186565](8186565)) * Add image-rendering optimize-contrast in map ([denysdovhan#225](https://github.com/cociweb/lawn-mower-card/issues/225)) ([e020983](e020983)) * Add pt.json in localize.json ([denysdovhan#258](https://github.com/cociweb/lawn-mower-card/issues/258)) ([edf33ad](edf33ad)) * Add sources for German ([denysdovhan#210](https://github.com/cociweb/lawn-mower-card/issues/210)) ([7389324](7389324)) * Add state ""docked" in ru.json ([denysdovhan#205](https://github.com/cociweb/lawn-mower-card/issues/205)) ([93726f4](93726f4)) * Added states for Deebot N79; including auto, spot, and edge. ([denysdovhan#206](https://github.com/cociweb/lawn-mower-card/issues/206)) ([5b18b3f](5b18b3f)) * Adding missing status in HE & Fix status location for RTL languages ([denysdovhan#232](https://github.com/cociweb/lawn-mower-card/issues/232)) ([07ebe3e](07ebe3e)) * bump ha-template ([031bd3b](031bd3b)) * circular progress ([4263164](4263164)) * compact view menu ([5c30871](5c30871)) * Corrected a typo in polish translation ([denysdovhan#223](https://github.com/cociweb/lawn-mower-card/issues/223)) ([cf44a7a](cf44a7a)) * Czech translation update ([denysdovhan#324](https://github.com/cociweb/lawn-mower-card/issues/324)) ([0bf94d8](0bf94d8)) * **deps:** fix stale ha-tempalte bundle ([9548c11](9548c11)) * duplicated in localize ([ae5c993](ae5c993)) * Ensure getAttributes().status is always string ([denysdovhan#702](https://github.com/cociweb/lawn-mower-card/issues/702)) ([a25f254](a25f254)) * Fix `getCardSize()` ([denysdovhan#222](https://github.com/cociweb/lawn-mower-card/issues/222)) ([3e8c4fc](3e8c4fc)) * fix broken ui in editor ([3108530](3108530)) * fix dropdown overflow ([9c02c46](9c02c46)), closes [denysdovhan#365](https://github.com/cociweb/lawn-mower-card/issues/365) * fix german translation ([denysdovhan#283](https://github.com/cociweb/lawn-mower-card/issues/283)) ([777939a](777939a)) * Fix hovering labels for ha-icon-buttons ([denysdovhan#372](https://github.com/cociweb/lawn-mower-card/issues/372)) ([76780e4](76780e4)) * fix problem with ha-template dep ([e6154c7](e6154c7)) * fix toolbar icon centering ([0a53a02](0a53a02)) * HA 2022.3.x ([043b622](043b622)) * ha-button-icon issue ([denysdovhan#278](https://github.com/cociweb/lawn-mower-card/issues/278)) ([32dd911](32dd911)) * he translation ([denysdovhan#265](https://github.com/cociweb/lawn-mower-card/issues/265)) ([0e9c796](0e9c796)) * missing , in ru.json ([c627c85](c627c85)) * More keys for Ukrainian and English ([112072f](112072f)) * no implicit any ([429426e](429426e)) * not rendering falsy values in stats. fix [denysdovhan#373](https://github.com/cociweb/lawn-mower-card/issues/373) ([df278f9](df278f9)) * Polish translation ([denysdovhan#308](https://github.com/cociweb/lawn-mower-card/issues/308)) ([37c3bd0](37c3bd0)) * problem with replacing pkg version ([851f0a2](851f0a2)) * **readme:** Add notice about Ukraine ([03d4799](03d4799)) * regeneratorRuntime is not defined. fix [denysdovhan#374](https://github.com/cociweb/lawn-mower-card/issues/374) ([65382d3](65382d3)) * remove comment. triger semantic release ([218000b](218000b)) * remove some conditions for release ([7945494](7945494)) * Remove unused @semantic-release/changelog ([9638b30](9638b30)) * returning key translation in ru.json ([denysdovhan#209](https://github.com/cociweb/lawn-mower-card/issues/209)) ([e67c495](e67c495)) * Russian translation.json ([denysdovhan#285](https://github.com/cociweb/lawn-mower-card/issues/285)) ([c101dd8](c101dd8)) * Spanish translation ([denysdovhan#186](https://github.com/cociweb/lawn-mower-card/issues/186)) ([1a68059](1a68059)) * The websocket command 'camera_thumbnail' has been deprecated. ([denysdovhan#201](https://github.com/cociweb/lawn-mower-card/issues/201)) ([f4a5e97](f4a5e97)) * untranspiled ?? operator ([64c8f71](64c8f71)) * Update and add missing in pl.json ([denysdovhan#299](https://github.com/cociweb/lawn-mower-card/issues/299)) ([85b06e8](85b06e8)) * Update cs.json ([denysdovhan#368](https://github.com/cociweb/lawn-mower-card/issues/368)) ([84344c6](84344c6)) * Update fr with missing field ([denysdovhan#226](https://github.com/cociweb/lawn-mower-card/issues/226)) ([7e8273a](7e8273a)) * Update German translation ([denysdovhan#674](https://github.com/cociweb/lawn-mower-card/issues/674)) ([025e9d8](025e9d8)) * update german translations for deebot vacuums ([denysdovhan#305](https://github.com/cociweb/lawn-mower-card/issues/305)) ([d8d5261](d8d5261)) * Update he.json ([denysdovhan#219](https://github.com/cociweb/lawn-mower-card/issues/219)) ([0b9a473](0b9a473)) * Update hu.json ([denysdovhan#605](https://github.com/cociweb/lawn-mower-card/issues/605)) ([1a92e99](1a92e99)) * Update locate icon to be aligned with vacuum card ([denysdovhan#182](https://github.com/cociweb/lawn-mower-card/issues/182)) ([3e45131](3e45131)), closes [denysdovhan#136](https://github.com/cociweb/lawn-mower-card/issues/136) * Update ru.json ([denysdovhan#602](https://github.com/cociweb/lawn-mower-card/issues/602)) ([733ce63](733ce63)) * Update Ukrainian translation ([denysdovhan#262](https://github.com/cociweb/lawn-mower-card/issues/262)) ([a6aa0fe](a6aa0fe)) * Updated polish translation ([denysdovhan#734](https://github.com/cociweb/lawn-mower-card/issues/734)) ([b7559ea](b7559ea)) * Updated pt translation ([denysdovhan#672](https://github.com/cociweb/lawn-mower-card/issues/672)) ([763fa40](763fa40)) * Updates to Finnish (fi) translation ([denysdovhan#608](https://github.com/cociweb/lawn-mower-card/issues/608)) ([584e19f](584e19f)) * use corrent branch name in release workflow ([bd87a10](bd87a10)) * Use default lit element in postcss-lit ([0828c08](0828c08)) * wrap actions ([denysdovhan#208](https://github.com/cociweb/lawn-mower-card/issues/208)) ([9003941](9003941)) ### Features * Add @semantic-release/git for updating version in the repo ([4fa126d](4fa126d)) * add ability to combine attribute and entity_id in stats ([e9d8667](e9d8667)) * add image entities as map entities ([15353d3](15353d3)) * Add Japanese Translation ([denysdovhan#719](https://github.com/cociweb/lawn-mower-card/issues/719)) ([bcba901](bcba901)) * Add norsk nynorsk (Norwegian) ([denysdovhan#199](https://github.com/cociweb/lawn-mower-card/issues/199)) ([73288b6](73288b6)) * Add romanian language ([denysdovhan#242](https://github.com/cociweb/lawn-mower-card/issues/242)) ([a5096ab](a5096ab)) * Add semantic release ([22ef139](22ef139)) * Add Traditional Chinese ([denysdovhan#196](https://github.com/cociweb/lawn-mower-card/issues/196)) ([c1ad452](c1ad452)) * add translation to simplified chinese ([denysdovhan#321](https://github.com/cociweb/lawn-mower-card/issues/321)) ([f4b50d3](f4b50d3)) * Add Vietnamese ([denysdovhan#203](https://github.com/cociweb/lawn-mower-card/issues/203)) ([50e5fe6](50e5fe6)) * Added brazilian portuguese language support ([denysdovhan#336](https://github.com/cociweb/lawn-mower-card/issues/336)) ([7d9f04f](7d9f04f)) * Added Catalan translation ([denysdovhan#190](https://github.com/cociweb/lawn-mower-card/issues/190)) ([34de65a](34de65a)) * Added finnish translation ([denysdovhan#173](https://github.com/cociweb/lawn-mower-card/issues/173)) ([e6fc812](e6fc812)) * Added lithuanian translation ([denysdovhan#215](https://github.com/cociweb/lawn-mower-card/issues/215)) ([f35cbe2](f35cbe2)) * Default button actions overrides ([denysdovhan#183](https://github.com/cociweb/lawn-mower-card/issues/183)) ([1ac4d93](1ac4d93)) * Fix color compatibility and add templates ([denysdovhan#353](https://github.com/cociweb/lawn-mower-card/issues/353)) ([4a03d0d](4a03d0d)) * **i18n:** add actions_array warn in Ukrainan ([ad05f3c](ad05f3c)) * New translations added for ES. ([denysdovhan#271](https://github.com/cociweb/lawn-mower-card/issues/271)) ([690fb86](690fb86)) * print version in console ([0a7e447](0a7e447)) * provide value inside value_template ([7a44cc5](7a44cc5)) * run semantic-release on Ci ([c13cb7b](c13cb7b)) * Updated Ukrainian translation ([denysdovhan#264](https://github.com/cociweb/lawn-mower-card/issues/264)) ([fd218b0](fd218b0)) ### BREAKING CHANGES * `actions` are replaced with `shortcuts` Co-authored-by: Denys Dovhan <[email protected]>
fan_speed_list
andstatus
values.Screens (local test)