├── LICENSE ├── README.md ├── ko.json ├── template.json ├── da.json └── de.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 CubeCoders Limited 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AMP Translations 2 | 3 | AMP 2.2.1.0 and newer support localisation through the use of a locale file that has the various AMP messages in different languages. These are accessible so that anyone can contribute new languages or collaborate on existing ones. 4 | 5 | ## Building Translation Files 6 | 7 | Under `WebRoot/Locale` you'll find a file called `xx.json` that shows you the structure of the language file. A copy of this also exists in this repo. 8 | 9 | Duplicate this file, and rename it to the appropriate two-letter [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for the language you're working on (e.g. `de.json` for German. 10 | 11 | Under the 'Strings' object, there is a key for each original text node in English, followed by its translation in whatever language you chose. You'll also need to replace the `LocaleName` object to match the ISO 639-1 code, and update the `MonthsOfYear`, `DaysOfWeek` and `LongDaysOfWeek` arrays to have the months and days in your target language. 12 | 13 | Any strings within AMP that don't exist in your translation file will remain as English, so you can work on it gradually over time. 14 | 15 | ## Determine missing translations 16 | 17 | AMP offers a TranslatorMode. To use it open your browser console (F12) and execute `Locale.SetTranslatorMode()`. While browsing through AMP it will keep track of translatable strings. After you're done using AMP for a bit execute `Locale.DownloadJSONFile()` to download your new JSON file. 18 | Note that you should enable the TranslatorMode already while on the login screen. 19 | 20 | Here is a script you can paste into the Console to generate a printout of most the strings: 21 | ``` 22 | var messages = {}; 23 | $("body *") 24 | .contents() 25 | .filter((_, e) => e.nodeType === Node.TEXT_NODE && e.textContent.match(/[a-zA-Z]\w/) && !e.textContent.contains("