Provides a function that loads a properties file from Appian Document Management and returns a dictionary of labels and values.
How to i18n your Form:
I ran into the issue with the first line on the translation file not loading if the file is encoded as UTF-8-BOM instead of just UTF-8. Hope this helps.
Nope, no messages at all in the logs and the loadbundle() function does still return a dictionary. It just seems like the first line isn't behaving correctly. No worries at all, let me know what you find whenever you get the chance. Thanks in advance!
Any messages in the logs? I won't get a chance to look at this until next week.
Mike Cichy Overall, this has been a great plugin but we ran into a strange error the other day. For whatever reason, the first key in this particular bundle localization file seems to be added as a string (rather than a key) to the resulting dictionary (test case 2 - viewing the expression). When we try to index() the value from the strange key, it returns a null (test case 2 - indexing the key). If the first line is a blank line, it seems like the plugin adds an empty string as the dictionary key with an empty value (test case 1).
I've built an app to reproduce the issue and highlight these test cases. As a workaround, we've simply added an empty first line before the key/value pairs. I looked through the bundle file in a text editor and haven't been able to identify any strange characters either. If someone has an answer as to what is causing this behaviour, it would be greatly appreciated. Thanks!
Test Case 1:
Test Case 2 - Viewing the expression:
Test Case 2 - Indexing the "hello" key:
Test Case Appian App: /cfs-file/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-bae752e8-2344-43c9-8f1e-a06bbcf919a8/Appian-i18n-Bug-Test-Case.zip
Are resource bundles once loaded cached in memory or are they reloaded with each call to load the bundle? Would it be a best practice to create smaller bundles for features, one bundle per application or one bundle across all applications?
@josephs646 Do you wrap the output with something else? Is your file encoded with something else other than UTF-8? The plugin is obviously designed to handle different languages, just wanted to verify the basics before I dig in through the code.
Re: example, the readme file explains the usage, there really isn't much to this other than loading key-value pairs from a file. See playbook page for usage: https://community.appian.com/w/the-appian-playbook/100/application-internationalization
I've tried to use this plug-in and working fine for the most part but I've found an issue that I can't seem to resolve within this plug-in:
inside the properties file I have a row: "caseDetails=DÉTAILS DU CAS"
when using the loadbundle() function the row is being returned from that properties file as "caseDetails:D�TAILS DU CAS"
I can replace char(65533) with char(233) when displaying this value. This solution is clearly not perfect since I am needing to assume that the � char should in fact be a É, but the same seems to be true with other accented chars. A more graceful way of handling this is to simply replace this label function/plug-in with:
if(userlocale( loggedInUser() ) = "fr_FR","DÉTAILS DU CAS","CASE DETAILS")
Of course there are a number of other ways I could do this (reference data held within a DB, using constants etc) but given that the plug-in suggests it works with complex characters I feel that I am missing something (also this loadbundle function seems to be substantially quicker than retrieving the same number of "translations" through a DB query, so my current preference is to stick with this plug-in)
I would also love to see examples of how to use this plugin.
Are there any examples of the use of this I can look at?
© 2021 Appian. All rights reserved.