Skip to content

Collect new .xml language files from different sources#13212

Merged
nikolajlauridsen merged 4 commits intov10/devfrom
v10/bugfix/pick-custom-language-xml-files
Oct 18, 2022
Merged

Collect new .xml language files from different sources#13212
nikolajlauridsen merged 4 commits intov10/devfrom
v10/bugfix/pick-custom-language-xml-files

Conversation

@elit0451
Copy link
Copy Markdown
Contributor

@elit0451 elit0451 commented Oct 14, 2022

Details

  • Gets .xml files for new languages (languages that Umbraco doesn't support) from other sources than umbraco/config/lang/, like:
    • /App_Plugins/mypackage/Lang/ - physical files or from RCLs
    • config/lang/ - physical files

Test

  • Pick a language from the list;
    • For the example, I chose Bulgarian (bg);
  • Create the following bg.xml file:
<?xml version="1.0" encoding="utf-8"?>
<language alias="bg" intName="Bulgarian" localName="български" lcid="" culture="bg-BG">
  <area alias="login">
    <key alias="greeting0">(BG) Happy super Sunday</key>
    <key alias="greeting1">(BG) Happy marvelous Monday</key>
    <key alias="greeting2">(BG) Happy tubular Tuesday</key>
    <key alias="greeting3">(BG) Happy wonderful Wednesday</key>
    <key alias="greeting4">(BG) Happy thunderous Thursday</key>
    <key alias="greeting5">(BG) Happy funky Friday</key>
    <key alias="greeting6">(BG) Happy Caturday</key>
	</area>
  <area alias="sections">
    <key alias="translation">(BG) Translation</key>
  </area>
</language>
  • Place it in different places** and verify that Bulgarian comes as an option in the list of Languages that you can select the menus and dialogues to be translated to, like here:
    image

** Different places like:

  • Umbraco.Cms.StaticAssets\wwwroot\App_Plugins\MyPackage\Lang;
  • Umbraco.Web.UI\App_Plugins\UIPackage\Lang;
  • Umbraco.Web.UI\config\lang;
  • Umbraco.Web.UI\umbraco\config\lang;

  • Switch the language to Bulgarian and verify that the name of the Translation section changes to "(BG) Translation";
  • Try setting the default backoffice language in appsettings by setting the Umbraco.CMS.Global.DefaultUILanguage key and verify that the login screen greetings changed to the ones we specified in the bg.xml file;
  "Umbraco": {
    "CMS": {
      "Global": {
        "DefaultUILanguage": "bg-BG", // or just "bg"
      }
   }
}

  • Delete the "packages" key from the "sections" area in en_us.xml file located in Umbraco.Core/EmbeddedResources/Lang/;
  <area alias="sections">
    <key alias="packages">Packages</key>
  </area>

and add the following new en_us.xml to either Umbraco.Cms.StaticAssets\wwwroot\App_Plugins\MyPackage\Lang or Umbraco.Web.UI\App_Plugins\UIPackage\Lang:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<language alias="en_us" intName="English (US)" localName="English (US)" lcid="" culture="en-US">
    <area alias="sections">
        <key alias="packages">Packages</key>
    </area>
</language>

  • Verify that you can still override existing language translation keys - follow the Greeting section:
    • NB ❗ : Remember to change back the "DefaultUILanguage": "en-us".

Copy link
Copy Markdown
Contributor

@nikolajlauridsen nikolajlauridsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests out good, and overall looks good to me, only found a couple of minor details 😄

@elit0451
Copy link
Copy Markdown
Contributor Author

Thanks for the review @nikolajlauridsen, I will fix up the things you pointed out! 💪

@nikolajlauridsen nikolajlauridsen merged commit 733f0b8 into v10/dev Oct 18, 2022
@nikolajlauridsen nikolajlauridsen deleted the v10/bugfix/pick-custom-language-xml-files branch October 18, 2022 06:22
nikolajlauridsen pushed a commit that referenced this pull request Oct 18, 2022
* Collecting new language files from different sources

* Apply suggestions from review

* Adding TODO for merging the language files locations to one when packages are not concerned
nikolajlauridsen added a commit that referenced this pull request Oct 19, 2022
* Fix broken selectable state for list view items (#13148)

* Add sync rendering extensions for block grid and async ones for block list (#13168)

* Re-add IsPackable to Umbraco.Tests.Integration

* Fix for potential race condition in packages search (#13153)

* search on input allowing to wait for copy/paste etc

* invoke resourcePromise() with correct parameters

* return the xhrStatus allowing the caller to check if the request was aborted

* fix: send in canceler.promise to allow the timeout to work

* catch any errors and ignore aborts if they happen

* move the logic to handle cancellations outside Angulars $scope.$apply

* remove file accidentally committed

* Fix for potential race condition in packages search (#13153)

* search on input allowing to wait for copy/paste etc

* invoke resourcePromise() with correct parameters

* return the xhrStatus allowing the caller to check if the request was aborted

* fix: send in canceler.promise to allow the timeout to work

* catch any errors and ignore aborts if they happen

* move the logic to handle cancellations outside Angulars $scope.$apply

* remove file accidentally committed

(cherry picked from commit 4a412bb)

* V10: Fix request accessor memory leak (#13152)

* Dispose OnChange event registration when disposing the notification handler

* Ensure that the ApplicationUrl is only initialized once

Since notifications handlers are transient,_hasAppUrl and _isInit defaults to false on every request causing it to always be called.

* Make notification handler and EnsureApplicationUrl internal

* Add missing ForceLeft and ForceRight (#13190)

* V10: Fix request accessor memory leak (#13152)

* Dispose OnChange event registration when disposing the notification handler

* Ensure that the ApplicationUrl is only initialized once

Since notifications handlers are transient,_hasAppUrl and _isInit defaults to false on every request causing it to always be called.

* Make notification handler and EnsureApplicationUrl internal

* Add missing ForceLeft and ForceRight (#13190)

* Pass the node property to umb-property & umb-property-editor (#13151)

Co-authored-by: Zeegaan <nge@umbraco.dk>

* V10: 13099 fix validation error (#13170)

* Add validation error message to Viewpicker

* Add help-inline class to make validation-text red

Co-authored-by: Zeegaan <nge@umbraco.dk>

* move clear:both; to the flexbox example (#13194)

* remove pointer-events from Image, to make drag n' drop work on firefox. (#13193)

* area permission min-max inputs width increase (#13195)

* Fix tags with CSV storage type (#13188)

* Fixing null check as default(NRT) is null => default(configuration?.Delimiter) is also null and we were counting on it being the same as default(char)

* Adding tests to check cases with multiple tags (or tag made of comma separated values)

* Fix tags with CSV storage type (#13188)

* Fixing null check as default(NRT) is null => default(configuration?.Delimiter) is also null and we were counting on it being the same as default(char)

* Adding tests to check cases with multiple tags (or tag made of comma separated values)

* Add documentation for default block grid partial views in the rendering extension methods (#13184)

* Add data-element to umb property so we can find it (#13199)

Co-authored-by: Zeegaan <nge@umbraco.dk>

* Add data-element to umb property so we can find it (#13199)

Co-authored-by: Zeegaan <nge@umbraco.dk>

* V10/bugfix/create simple package test (#13162)

* Fixed assert to hopefully find the package each time so it isnt flaky anymore

* Updated so it retries 5 times instead of 2

* Dont submit html-report

* Dont have output defined in npm run

* Copy over playwright trace.zip files before publishing

* Updated assert so it looks after the package in the table

* updated so we get the first fail as the trace file

* Bumped version for testhelpers

* Updated so the test checks if the package actually exists. Added a wait that checks if the created packages button is visible

* Updated package lock

* Fixed so it now calls the correct testhelper

Co-authored-by: Zeegaan <nge@umbraco.dk>

* Merge BjarneF fix into 10.3 (#13220)

Co-authored-by: Bjarne Fyrstenborg <bjarne_fyrstenborg@hotmail.com>

* make Area fit within block row (#13221)

* 10.3.0-RC: Change grid area input to number + change generic label (#13203)

Co-authored-by: Bjarne Fyrstenborg <bjarne_fyrstenborg@hotmail.com>

* move below center, to make room (#13222)

* highlight areas in dragging-mode for modern browsers (#13224)

* Collect new .xml language files from different sources (#13212)

* Collecting new language files from different sources

* Apply suggestions from review

* Adding TODO for merging the language files locations to one when packages are not concerned

* Collect new .xml language files from different sources (#13212)

* Collecting new language files from different sources

* Apply suggestions from review

* Adding TODO for merging the language files locations to one when packages are not concerned

* Resync editors if content model changed (#13230)

* Disable BlockGridEditor (#13229)

* Disable BlockGridEditor

* Fix typeloader test

* Update src/Umbraco.Core/Models/Blocks/BlockGridItem.cs

Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>

* Apply suggestions from code review

Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>

Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>

* V10.4: Re-enable block grid editor (#13231)

* Revert "Disable BlockGridEditor (#13229)"

This reverts commit 4e9aa8d.

* Re-do xml comments fix

* Fix nullable reference error

* Fix acceptance test package.json and package-lock.json

* Re-add wait-on

Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
Co-authored-by: Zeegaan <nge@umbraco.dk>
Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com>
Co-authored-by: Bjarne Fyrstenborg <bjarne_fyrstenborg@hotmail.com>
Co-authored-by: Matt Darby <matt@darby.digital>
@FrancisGroleau
Copy link
Copy Markdown

why filter out the user.xml files ? now if I add an en-CA.user.xml file it won't be taken as a Language file and so when the UmbracoErrorDescriberBase that uses the ILocalizedTextService can't retrieve the localized message for Identity Framework Errors ?

@elit0451
Copy link
Copy Markdown
Contributor Author

Hi @FrancisGroleau 👋

Apologies for getting back to you just now. As I mentioned in a comment in the linked issue, user.xml files are for overriding existing translations:

If you want to create a 'user' translation file to override existing language translation keys, you need to have an .xml language file for the same language first, to be able to override anything.

So, once you have en-CA.xml file, it will be picked up as a language file 😌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants